Trait Op1

Source
pub trait Op1: Clone + Display {
    // Required methods
    fn cost(&self) -> usize;
    fn try_eval(&self, a1: Value) -> (bool, Value);
}
Expand description

Defines a trait for unary operations that supports cloning and formatting.

This trait requires implementing a method to determine the operation’s cost and another to attempt evaluation on a single input value. The cost method returns the computational expense of the operation as a usize, providing a way to assess the relative resource consumption. The try_eval method takes a single argument, a1, of type Value, and returns a tuple, where the first element is a boolean indicating success or failure of the evaluation, and the second element contains the resulting Value. This trait layout allows for flexibility and modularity when defining unary operations within the string synthesis framework.

Required Methods§

Source

fn cost(&self) -> usize

Source

fn try_eval(&self, a1: 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.

Implementors§