Skip to main content

ClassCache

Struct ClassCache 

Source
pub struct ClassCache<M> { /* private fields */ }
Expand description

A bounded managed class universe with non-retaining derived caches.

Implementations§

Source§

impl<M: Clone> ClassCache<M>

Source

pub fn new(max_objects: usize) -> Result<Self, CacheError>

Creates a cache with a hard cap shared by classes and derived values.

Source

pub fn allocate_class( &mut self, parents: &[ClassRoot], members: Vec<M>, ) -> Result<ClassRoot, CacheError>

Allocates and roots a class with its declared parents and members.

Source

pub fn replace_parents( &mut self, class: ClassRoot, parents: &[ClassRoot], ) -> Result<(), CacheError>

Replaces declared parents and bumps the parent revision.

Source

pub fn replace_members( &mut self, class: ClassRoot, members: Vec<M>, ) -> Result<(), CacheError>

Replaces declared members and bumps the member revision.

Source

pub fn derived<P>( &mut self, class: ClassRoot, policy: &P, budget: LineageBudget, ) -> Result<CacheAccess<M>, CacheError>

Returns a revision-validated cached view or computes and installs one.

Source

pub fn release(&mut self, class: ClassRoot) -> Result<(), CacheError>

Releases the caller’s strong root. Collection can then reclaim the class and cache value.

Source

pub fn collect( &mut self, limits: CollectionLimits, ) -> Result<CollectionReceipt, CacheError>

Runs bounded MANAGED_2 tracing collection and returns its exact receipt.

Source

pub fn managed_len(&self) -> usize

Returns the current number of managed manager, class, and derived objects.

Auto Trait Implementations§

§

impl<M> Freeze for ClassCache<M>

§

impl<M> RefUnwindSafe for ClassCache<M>
where M: RefUnwindSafe,

§

impl<M> Send for ClassCache<M>
where M: Send,

§

impl<M> Sync for ClassCache<M>
where M: Sync,

§

impl<M> Unpin for ClassCache<M>

§

impl<M> UnsafeUnpin for ClassCache<M>

§

impl<M> UnwindSafe for ClassCache<M>
where M: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.