pub struct FftPlanCache { /* private fields */ }Expand description
Bounded, caller-owned typed cache for backend FFT plans and workspaces.
crate::FftExecutor owns one cache and passes its store to every
crate::FftBackend through crate::FftExecutionCache. Backends retain
private Send + Sync + 'static values under their own
[ExtensionCacheKey] namespace. Entry limits, LRU eviction, clearing,
aggregate entry counts, and retained-byte accounting apply uniformly to CPU
and non-CPU entries.
The CPU backend stores RustFFT plans in the private rustfft-plans
namespace. Its retained-byte estimate includes the exact plan key and the
cache-owned Arc handle; allocations opaque to RustFFT are excluded.
§Examples
use std::num::NonZeroUsize;
use tenferro_fft::FftPlanCache;
let cache = FftPlanCache::with_capacity(NonZeroUsize::new(2).unwrap());
assert_eq!(cache.capacity().get(), 2);
assert_eq!(cache.stats().entries, 0);Implementations§
Source§impl FftPlanCache
impl FftPlanCache
Sourcepub fn with_capacity(capacity: NonZeroUsize) -> Self
pub fn with_capacity(capacity: NonZeroUsize) -> Self
Create an empty typed cache with an explicit maximum entry count.
Sourcepub fn capacity(&self) -> NonZeroUsize
pub fn capacity(&self) -> NonZeroUsize
Maximum number of retained backend entries across all namespaces.
Sourcepub fn set_limits(&mut self, limits: ExtensionCacheLimits)
pub fn set_limits(&mut self, limits: ExtensionCacheLimits)
Replace complete cache retention limits.
Sourcepub fn set_capacity(&mut self, capacity: NonZeroUsize)
pub fn set_capacity(&mut self, capacity: NonZeroUsize)
Resize the cache, evicting least-recently-used entries when necessary.
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Snapshot aggregate entries and backend-reported retained bytes.
Trait Implementations§
Source§impl Debug for FftPlanCache
impl Debug for FftPlanCache
Source§impl Default for FftPlanCache
impl Default for FftPlanCache
Source§impl RuntimeCacheControl for FftPlanCache
impl RuntimeCacheControl for FftPlanCache
Auto Trait Implementations§
impl Freeze for FftPlanCache
impl !RefUnwindSafe for FftPlanCache
impl Send for FftPlanCache
impl Sync for FftPlanCache
impl Unpin for FftPlanCache
impl UnsafeUnpin for FftPlanCache
impl !UnwindSafe for FftPlanCache
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
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>
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>
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