Trait ConstantFolder

Source
pub trait ConstantFolder: Sized {
    // Required methods
    fn resolve_to_string_subexpressions(
        &mut self,
        dst: StringExpressionId,
        newval: StringExpressionId,
    );
    fn resolve_to_int_subexpressions(
        &mut self,
        dst: IntegerExpressionId,
        newval: IntegerExpressionId,
    );
    fn resolve_to_real_subexpressions(
        &mut self,
        dst: RealExpressionId,
        newval: RealExpressionId,
    );
    fn mir(&self) -> &Mir;

    // Provided methods
    fn real_constant_fold(
        &mut self,
        resolver: &mut impl ConstantResolver,
        expr: RealExpressionId,
    ) -> Option<f64> { ... }
    fn int_constant_fold(
        &mut self,
        resolver: &mut impl ConstantResolver,
        expr: IntegerExpressionId,
    ) -> Option<i64> { ... }
    fn string_constant_fold(
        &mut self,
        resolver: &mut impl ConstantResolver,
        expr: StringExpressionId,
    ) -> Option<StringLiteral> { ... }
}

Required Methods§

Provided Methods§

Source

fn real_constant_fold( &mut self, resolver: &mut impl ConstantResolver, expr: RealExpressionId, ) -> Option<f64>

Source

fn int_constant_fold( &mut self, resolver: &mut impl ConstantResolver, expr: IntegerExpressionId, ) -> Option<i64>

Source

fn string_constant_fold( &mut self, resolver: &mut impl ConstantResolver, expr: StringExpressionId, ) -> Option<StringLiteral>

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§