pub struct CapRef { /* private fields */ }Expand description
Cache-local lifetime handle to a working Cap::Instance in
CacheDirectory.instances. Clone bumps the refcount; the
directory’s sweep_instances reclaims entries whose only holder is
the directory itself. Two separate CacheDirectory instances produce
independent CapRef id namespaces — refs must not cross caches.
Implementations§
Source§impl CapRef
impl CapRef
Sourcepub fn new(id: u64) -> Self
pub fn new(id: u64) -> Self
Construct a fresh CapRef. Only [crate::cache::CacheDirectory:: put_instance] and tests are expected to call this.
Sourcepub fn strong_count(&self) -> usize
pub fn strong_count(&self) -> usize
Number of live CapRef clones for this id, including the
directory’s own self-reference. sweep_instances reclaims
entries whose stored handle has strong_count == 1.
Trait Implementations§
impl Eq for CapRef
Auto Trait Implementations§
impl Freeze for CapRef
impl RefUnwindSafe for CapRef
impl Send for CapRef
impl Sync for CapRef
impl Unpin for CapRef
impl UnsafeUnpin for CapRef
impl UnwindSafe for CapRef
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.