pub trait Op3: Clone + Display {
// Required methods
fn cost(&self) -> usize;
fn try_eval(&self, a1: Value, a2: Value, a3: Value) -> (bool, Value);
}
Expand description
A trait defining a ternary operation.
It represents operations that take three argument values and provides methods to evaluate and determine the cost of performing the operation.
Implementations of this trait must provide a cost
method that returns the operation’s cost as an unsigned size.
The try_eval
method attempts to evaluate the operation with three input values, returning a tuple where the first element indicates success as a boolean and the second element contains the resultant value.
This trait requires its implementers to be clonable and displayable, facilitating duplication and formatted output of operation instances.
Required Methods§
fn cost(&self) -> usize
fn try_eval(&self, a1: Value, a2: Value, a3: Value) -> (bool, Value)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.