pub struct ValueCache<N, V, VF> { /* private fields */ }Expand description
Helper struct for constructing a value flow graph. It caches the results of applying value_fn to nodes, and also keeps track of the mapping from values to nodes and nodes to values.
Implementations§
Source§impl<N, V, VF, E> ValueCache<N, V, VF>
impl<N, V, VF, E> ValueCache<N, V, VF>
Sourcepub fn new(value_fn: VF) -> Self
pub fn new(value_fn: VF) -> Self
Creates a new ValueCache that uses the given function to get values.
Sourcepub async fn get_value(&mut self, node: &N) -> Result<Rc<V>, E>
pub async fn get_value(&mut self, node: &N) -> Result<Rc<V>, E>
Returns the value for the given node, computing it if it is not already cached.
Sourcepub fn get_nodes_for_value(&self, value: &Rc<V>) -> Option<&Vec<N>>
pub fn get_nodes_for_value(&self, value: &Rc<V>) -> Option<&Vec<N>>
Returns the nodes that have the given value.
Auto Trait Implementations§
impl<N, V, VF> !Send for ValueCache<N, V, VF>
impl<N, V, VF> !Sync for ValueCache<N, V, VF>
impl<N, V, VF> Freeze for ValueCache<N, V, VF>where
VF: Freeze,
impl<N, V, VF> RefUnwindSafe for ValueCache<N, V, VF>
impl<N, V, VF> Unpin for ValueCache<N, V, VF>
impl<N, V, VF> UnsafeUnpin for ValueCache<N, V, VF>where
VF: UnsafeUnpin,
impl<N, V, VF> UnwindSafe for ValueCache<N, V, VF>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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