pub struct ConstOrigin { /* private fields */ }Expand description
A weak handle on the shared host array a Const was built from (see ConstOriginKey).
Holds only a Weak, so recording an origin never extends the array’s life: a per-call array
(a token-id table, a RoPE table, a mask) has no live source by the time anyone asks and
Self::pin returns None for it, while a model weight, still held by the model, pins.
Implementations§
Source§impl ConstOrigin
impl ConstOrigin
Sourcepub fn key(&self) -> ConstOriginKey
pub fn key(&self) -> ConstOriginKey
The identity of the source array.
Sourcepub fn pin(&self) -> Option<Box<dyn Any + Send + Sync>>
pub fn pin(&self) -> Option<Box<dyn Any + Send + Sync>>
A strong handle that keeps the source array alive, or None if it is already gone (the
Const was built from a per-call array). Hold it for as long as Self::key is trusted.
Sourcepub fn strong_count(&self) -> usize
pub fn strong_count(&self) -> usize
How many strong handles the source array has right now, pins included. A holder of one pin
sees 1 when nothing else (no model) holds the array any more, which is its cue to let go.
Trait Implementations§
Source§impl Clone for ConstOrigin
impl Clone for ConstOrigin
Auto Trait Implementations§
impl !RefUnwindSafe for ConstOrigin
impl !UnwindSafe for ConstOrigin
impl Forget for ConstOrigin
impl Freeze for ConstOrigin
impl Move for ConstOrigin
impl Send for ConstOrigin
impl Sync for ConstOrigin
impl Unpin for ConstOrigin
impl UnsafeUnpin for ConstOrigin
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