pub struct VecCache<'f, O> { /* private fields */ }
Expand description
A cache for a function which uses a Vec
.
This cache is optimized for functions which must
be calculated in order, so that there can be no
gaps in the cache, and use usize
as an argument.
If the function does not start at zero, or require
every previous value to be calculated for the next
one, consider using a HashCache
instead.
Implementations§
Source§impl<'f, O> VecCache<'f, O>
impl<'f, O> VecCache<'f, O>
Sourcepub fn new<F>(f: F) -> Self
pub fn new<F>(f: F) -> Self
Create a cache for the provided function. If the function stores references, the cache can only live as long as those references.
Sourcepub fn recursive<F>(f: F) -> Self
pub fn recursive<F>(f: F) -> Self
Create a cache for the provided recursive function. If the function stores references, the cache can only live as long as those references.
Trait Implementations§
Source§impl<'f, O> FnCacheMany<usize, O> for VecCache<'f, O>
impl<'f, O> FnCacheMany<usize, O> for VecCache<'f, O>
Auto Trait Implementations§
impl<'f, O> Freeze for VecCache<'f, O>
impl<'f, O> !RefUnwindSafe for VecCache<'f, O>
impl<'f, O> Send for VecCache<'f, O>where
O: Send,
impl<'f, O> Sync for VecCache<'f, O>where
O: Sync,
impl<'f, O> Unpin for VecCache<'f, O>where
O: Unpin,
impl<'f, O> !UnwindSafe for VecCache<'f, O>
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