Propagator

Struct Propagator 

Source
pub struct Propagator { /* private fields */ }
Expand description

A utility for computing Conventions. Given the Convention at the end of a piece of code, this utility can calculate the Convention at the beginning.

Implementations§

Source§

impl Propagator

Source

pub fn new(after: &Convention) -> Self

Constructs a Propagator given the Convention after the code.

Source

pub fn insert(&mut self, src: impl IntoVariable)

Adds src to lives.

Source

pub fn remove(&mut self, dest: impl IntoVariable)

Removes dest from lives.

Source

pub fn branch(&mut self, other: &Convention)

Propagate information backwards through a conditional branch. Variables live in other are added to lives.

Source

pub fn switch<'a, C>( discriminant: Variable, switch: &'a Switch<C>, to_convention: impl Fn(&C) -> &'a Convention, ) -> Self

Propagate information backwards through a Switch. Variables live in every case of switch are included in lives, along with discriminant.

Source

pub fn action(&mut self, action: Action)

Propagate information backwards through action. Variables written by action are removed from lives and those read by it are added.

Source

pub fn before(&self) -> Convention

Returns the Convention before the code.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.