Trait ConstFold

Source
pub trait ConstFold: Send + Sync {
    // Required method
    fn fold(
        &self,
        type_args: &[TypeArg],
        consts: &[(IncomingPort, Value)],
    ) -> ConstFoldResult;
}
Expand description

Trait implemented by extension operations that can perform constant folding.

Required Methods§

Source

fn fold( &self, type_args: &[TypeArg], consts: &[(IncomingPort, Value)], ) -> ConstFoldResult

Given type arguments type_args and crate::ops::Const values for inputs at crate::IncomingPorts, try to evaluate the operation.

Trait Implementations§

Source§

impl Debug for Box<dyn ConstFold>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Implementors§

Source§

impl ConstFold for LogicOp

Source§

impl ConstFold for TupleOpDef

Source§

impl ConstFold for LoadNatDef

Source§

impl ConstFold for NoopDef

Source§

impl ConstFold for Folder

Source§

impl<T> ConstFold for T
where T: Fn(&[(IncomingPort, Value)]) -> ConstFoldResult + Send + Sync,

Blanket implementation for functions that only require the constants to evaluate - type arguments are not relevant.