flux_middle::rty::evars

Struct EVarGen

Source
pub struct EVarGen<T> {
    stack: FxIndexMap<EVarCxId, EVarCtxt<T>>,
    pending: FxIndexMap<EVarCxId, EVarCtxt<T>>,
}
Expand description

A generator of evars. Evars are associated with a context. Contexts are visited in a stack-like fashion. When entering a context data can be associated to that particular context. When a context is exited, all its evars are put in a list of pending contexts. No more evars can be generated for pending contexts, but they can still be unified. At any point, pending contexts can be solved, returning a solution for all of their evars or an error if some evar hasn’t been unified yet.

Fields§

§stack: FxIndexMap<EVarCxId, EVarCtxt<T>>§pending: FxIndexMap<EVarCxId, EVarCtxt<T>>

Implementations§

Source§

impl<T> EVarGen<T>

Source

pub fn enter_context(&mut self, data: T) -> EVarCxId

Enters a new context generating a context id guaranteed to be globally fresh. That is, it will be unique among context ids generated by this or other instances of EVarGen. The context can be used to generate fresh evars by calling EVarGen::fresh_in.

Source

pub fn exit_context(&mut self) -> EVarCxId

Exit the current context, putting it in the pending list.

Source

pub fn fresh_in(&mut self, cxid: EVarCxId) -> EVar

Generates an evar guaranteed to be fresh in the provided context.

§Panics

This function panics if the context cxid was not generated by this EVarGen instance or has already been popped.

Source

pub fn fresh_in_current(&mut self) -> EVar

Generates a fresh evar in the current (top of the stack) context

Source

pub fn data(&self, cxid: EVarCxId) -> &T

Returns the data associated with the context cxid

§Panics

This function panics if the context cxid was not generated by this EVarGen instance.

Source

pub fn current_data(&self) -> &T

Source

pub fn unify(&mut self, evar: EVar, arg: impl Into<Expr>, replace: bool)

Source

pub fn try_solve_pending(&mut self) -> Result<EVarSol, UnsolvedEvar>

Try to solve evars in all pending contexts and then empty the pending list.

Trait Implementations§

Source§

impl<T: Debug> Debug for EVarGen<T>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T> Default for EVarGen<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<T> Freeze for EVarGen<T>

§

impl<T> RefUnwindSafe for EVarGen<T>
where T: RefUnwindSafe,

§

impl<T> Send for EVarGen<T>
where T: Send,

§

impl<T> Sync for EVarGen<T>
where T: Sync,

§

impl<T> Unpin for EVarGen<T>
where T: Unpin,

§

impl<T> UnwindSafe for EVarGen<T>
where T: UnwindSafe,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<P> IntoQueryParam<P> for P

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.