pub struct ProjectedFactorCache { /* private fields */ }Expand description
Memoizer for projected factor products keyed on a (design, factor) fingerprint.
Implementations§
Source§impl ProjectedFactorCache
impl ProjectedFactorCache
pub const DEFAULT_BUDGET_BYTES: usize
pub fn with_budget(budget_bytes: usize) -> Self
pub fn get_or_insert_with( &self, key: ProjectedFactorKey, compute: impl FnOnce() -> Array2<f64>, ) -> Arc<Array2<f64>> ⓘ
pub fn len(&self) -> usize
pub fn total_bytes(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn wait_for_subscriber(
&self,
key: ProjectedFactorKey,
timeout: Duration,
) -> bool
pub fn wait_for_subscriber( &self, key: ProjectedFactorKey, timeout: Duration, ) -> bool
Test/diagnostic affordance: block until a consumer has subscribed to the
in-progress slot for key (i.e. is waiting on the producer), or until
timeout elapses. Returns true if a subscriber arrived, false if the
key has no in-progress slot or the wait timed out.
This lives on the cache because it reaches into the per-key subscriber condvar and waiter counter, which are private synchronization internals; exposing it as a method keeps those fields encapsulated while still letting downstream tests deterministically order producer/consumer interleavings.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ProjectedFactorCache
impl RefUnwindSafe for ProjectedFactorCache
impl Send for ProjectedFactorCache
impl Sync for ProjectedFactorCache
impl Unpin for ProjectedFactorCache
impl UnsafeUnpin for ProjectedFactorCache
impl UnwindSafe for ProjectedFactorCache
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> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
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