pub struct KernelCache { /* private fields */ }Expand description
A bounded LRU of compiled kernels (docs/EAGER.md §8.2).
Implementations§
Source§impl KernelCache
impl KernelCache
Sourcepub fn new(capacity: usize) -> Self
pub fn new(capacity: usize) -> Self
A cache holding at most capacity compiled kernels (capacity is
clamped to at least 1).
Sourcepub fn get_or_create<E>(
&mut self,
key: KernelCacheKey,
create: impl FnOnce() -> Result<Box<dyn Kernel>, E>,
) -> Result<Arc<Mutex<Box<dyn Kernel>>>, E>
pub fn get_or_create<E>( &mut self, key: KernelCacheKey, create: impl FnOnce() -> Result<Box<dyn Kernel>, E>, ) -> Result<Arc<Mutex<Box<dyn Kernel>>>, E>
Return the cached kernel for key, compiling and inserting it via
create on a miss (docs/EAGER.md §8.2 get_or_create).
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Current cache statistics.
Auto Trait Implementations§
impl Freeze for KernelCache
impl RefUnwindSafe for KernelCache
impl Send for KernelCache
impl Sync for KernelCache
impl Unpin for KernelCache
impl UnsafeUnpin for KernelCache
impl UnwindSafe for KernelCache
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> 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