pub trait OperationReflect: Sized {
type OpCode;
// Required method
fn op_code(&self) -> Self::OpCode;
// Provided methods
fn args(&self) -> Option<Vec<Variable>> { ... }
fn from_code_and_args(
op_code: Self::OpCode,
args: &[Variable],
) -> Option<Self> { ... }
fn is_commutative(&self) -> bool { ... }
fn is_pure(&self) -> bool { ... }
}
Expand description
An operation that can be reflected on
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn args(&self) -> Option<Vec<Variable>>
fn args(&self) -> Option<Vec<Variable>>
Get the list of arguments for this operation. If not all arguments are Variable
, returns
None
instead.
Sourcefn from_code_and_args(op_code: Self::OpCode, args: &[Variable]) -> Option<Self>
fn from_code_and_args(op_code: Self::OpCode, args: &[Variable]) -> Option<Self>
Create typed operation from an opcode and a list of arguments. Returns None
if not all
arguments are Variable
.
Sourcefn is_commutative(&self) -> bool
fn is_commutative(&self) -> bool
Whether this operation is commutative (arguments can be freely reordered). Ignored for single argument operations.
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.