Struct s2n_quic_core::memo::Memo
source · pub struct Memo<T: Copy, Input, Check = DefaultConsistencyCheck> { /* private fields */ }
Expand description
A datastructure that memoizes a query function
This can be used for when queries rarely change and can potentially be expensive or on hot
code paths. After the input
is mutated, the query value should be clear
ed to signal that
the function needs to be executed again.
In debug mode the get
call will always run the query and assert that the values match.
Implementations§
source§impl<T: Copy + PartialEq + Debug, Input, Check: ConsistencyCheck> Memo<T, Input, Check>
impl<T: Copy + PartialEq + Debug, Input, Check: ConsistencyCheck> Memo<T, Input, Check>
Trait Implementations§
Auto Trait Implementations§
impl<T, Input, Check = ConsistencyCheckAlways> !Freeze for Memo<T, Input, Check>
impl<T, Input, Check = ConsistencyCheckAlways> !RefUnwindSafe for Memo<T, Input, Check>
impl<T, Input, Check> Send for Memo<T, Input, Check>
impl<T, Input, Check = ConsistencyCheckAlways> !Sync for Memo<T, Input, Check>
impl<T, Input, Check> Unpin for Memo<T, Input, Check>
impl<T, Input, Check> UnwindSafe for Memo<T, Input, Check>where
Check: UnwindSafe,
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
Mutably borrows from an owned value. Read more