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>
impl<T> EVarGen<T>
Sourcepub fn enter_context(&mut self, data: T) -> EVarCxId
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
.
Sourcepub fn exit_context(&mut self) -> EVarCxId
pub fn exit_context(&mut self) -> EVarCxId
Exit the current context, putting it in the pending list.
Sourcepub fn fresh_in_current(&mut self) -> EVar
pub fn fresh_in_current(&mut self) -> EVar
Generates a fresh evar in the current (top of the stack) context
pub fn current_data(&self) -> &T
pub fn unify(&mut self, evar: EVar, arg: impl Into<Expr>, replace: bool)
Sourcepub fn try_solve_pending(&mut self) -> Result<EVarSol, UnsolvedEvar>
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§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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