pub struct Demand<Var: Hash + Eq + Copy, UsePosition, Aux: Clone + Default = ()> {
pub vars: OrderedHashMap<Var, UsePosition>,
pub aux: Aux,
}
Expand description
Demanded variables from a certain point in the flow until the end of the function. Needs to be updates in backwards order.
Fields§
§vars: OrderedHashMap<Var, UsePosition>
§aux: Aux
Implementations§
Source§impl<Var: Hash + Eq + Copy, UsePosition: Copy, Aux: Clone + Default + AuxCombine> Demand<Var, UsePosition, Aux>
impl<Var: Hash + Eq + Copy, UsePosition: Copy, Aux: Clone + Default + AuxCombine> Demand<Var, UsePosition, Aux>
Sourcepub fn finalize(self) -> bool
pub fn finalize(self) -> bool
Finalizes a demand. Returns a boolean representing success - if all the variable demands were satisfied.
Sourcepub fn apply_remapping<'a, V: Copy + Into<Var> + 'a, T: DemandReporter<Var, Aux, UsePosition = UsePosition>>(
&mut self,
reporter: &mut T,
remapping: impl DoubleEndedIterator<Item = (&'a V, (&'a V, T::UsePosition))> + ExactSizeIterator,
)
pub fn apply_remapping<'a, V: Copy + Into<Var> + 'a, T: DemandReporter<Var, Aux, UsePosition = UsePosition>>( &mut self, reporter: &mut T, remapping: impl DoubleEndedIterator<Item = (&'a V, (&'a V, T::UsePosition))> + ExactSizeIterator, )
Updates the demand when a variable remapping occurs.
Sourcepub fn variables_used<'a, V: Copy + Into<Var> + 'a, T: DemandReporter<Var, Aux, UsePosition = UsePosition>>(
&mut self,
reporter: &mut T,
vars: impl DoubleEndedIterator<Item = (&'a V, T::UsePosition)> + ExactSizeIterator,
)
pub fn variables_used<'a, V: Copy + Into<Var> + 'a, T: DemandReporter<Var, Aux, UsePosition = UsePosition>>( &mut self, reporter: &mut T, vars: impl DoubleEndedIterator<Item = (&'a V, T::UsePosition)> + ExactSizeIterator, )
Updates the demand when some variables are used right before the current flow.
Sourcepub fn variables_introduced<V: Copy + Into<Var>, T: DemandReporter<Var, Aux>>(
&mut self,
reporter: &mut T,
vars: &[V],
position: T::IntroducePosition,
)
pub fn variables_introduced<V: Copy + Into<Var>, T: DemandReporter<Var, Aux>>( &mut self, reporter: &mut T, vars: &[V], position: T::IntroducePosition, )
Updates the demand when some variables are introduced right before the current flow.
Sourcepub fn merge_demands<T: DemandReporter<Var, Aux>>(
demands: &[(Self, T::IntroducePosition)],
reporter: &mut T,
) -> Self
pub fn merge_demands<T: DemandReporter<Var, Aux>>( demands: &[(Self, T::IntroducePosition)], reporter: &mut T, ) -> Self
Merges Demands from multiple branches into one, reporting diagnostics in the way.
Trait Implementations§
Auto Trait Implementations§
impl<Var, UsePosition, Aux> Freeze for Demand<Var, UsePosition, Aux>where
Aux: Freeze,
impl<Var, UsePosition, Aux> RefUnwindSafe for Demand<Var, UsePosition, Aux>
impl<Var, UsePosition, Aux> Send for Demand<Var, UsePosition, Aux>
impl<Var, UsePosition, Aux> Sync for Demand<Var, UsePosition, Aux>
impl<Var, UsePosition, Aux> Unpin for Demand<Var, UsePosition, Aux>
impl<Var, UsePosition, Aux> UnwindSafe for Demand<Var, UsePosition, Aux>
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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 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>
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