pub trait Attribute {
    type Value: Clone + Eq + PartialEq;

    // Required methods
    fn derive(&mut self, expr: &MirRelationExpr, deps: &DerivedAttributes<'_>);
    fn add_dependencies(builder: &mut DerivedAttributesBuilder<'_>);
    fn get_results(&self) -> &Vec<Self::Value>;
    fn get_results_mut(&mut self) -> &mut Vec<Self::Value>;
    fn take(self) -> Vec<Self::Value>;

    // Provided methods
    fn schedule_env_tasks(&mut self, _expr: &MirRelationExpr) { ... }
    fn handle_env_tasks(&mut self) { ... }
}
Expand description

A common interface to be implemented by all derived attributes.

Required Associated Types§

source

type Value: Clone + Eq + PartialEq

The domain of the attribute values.

Required Methods§

source

fn derive(&mut self, expr: &MirRelationExpr, deps: &DerivedAttributes<'_>)

Derive an attribute.

source

fn add_dependencies(builder: &mut DerivedAttributesBuilder<'_>)

The attribute ids of all other attributes that this attribute depends on.

source

fn get_results(&self) -> &Vec<Self::Value>

Attributes for each subexpression, visited in post-order.

source

fn get_results_mut(&mut self) -> &mut Vec<Self::Value>

Mutable attributes for each subexpression, visited in post-order.

source

fn take(self) -> Vec<Self::Value>

Consume self and return the attributes for each subexpression.

Provided Methods§

source

fn schedule_env_tasks(&mut self, _expr: &MirRelationExpr)

Schedule environment maintenance tasks.

Delegate to Env::schedule_tasks if this attribute has an Env field.

source

fn handle_env_tasks(&mut self)

Handle scheduled environment maintenance tasks.

Delegate to Env::handle_tasks if this attribute has an Env field.

Object Safety§

This trait is not object safe.

Implementors§