Skip to main content

EffectSink

Trait EffectSink 

Source
pub trait EffectSink {
    // Required methods
    fn on_call(&mut self, call: &Call<'_>);
    fn on_assert(&mut self, assert: &Assert<'_>);
    fn on_raise(&mut self, raise: &Raise<'_>);
    fn on_assign_target(
        &mut self,
        target: &AssignTargetExpression<'_>,
        is_aug: bool,
    );

    // Provided method
    fn on_attribute_read(&mut self, _attr: &Expression<'_>) { ... }
}
Expand description

A sink that receives the eagerly-evaluated effect sites of a function’s own body, as decided by walk_own_body. Each method is a classify_* → push hook.

Required Methods§

Source

fn on_call(&mut self, call: &Call<'_>)

A function/method call evaluated in the enclosing body.

Source

fn on_assert(&mut self, assert: &Assert<'_>)

A bare assert statement (conditional abort; stripped under -O).

Source

fn on_raise(&mut self, raise: &Raise<'_>)

A raise statement.

Source

fn on_assign_target( &mut self, target: &AssignTargetExpression<'_>, is_aug: bool, )

An assignment target that may be an env write (os.environ[...] = …) or a mutation. is_aug is true for an augmented assignment (+=, |=, …), false for a plain =. A plain = to a bare local name is a binding, not a mutation of pre-existing state (spec §“effect table”: local.mutation is .append() / d[k] = … / += on a locally-created binding — not the binding itself); subscript/attribute = targets still mutate.

Provided Methods§

Source

fn on_attribute_read(&mut self, _attr: &Expression<'_>)

An attribute read that may be an ambient-read signal (e.g. sys.argv). Default: no-op (most sinks don’t care).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§