Skip to main content

CacheEntry

Struct CacheEntry 

Source
pub struct CacheEntry {
    pub seq: Seq,
    pub tokens: Vec<u32>,
    pub pins: u32,
    pub last_used: u64,
    pub bytes: u64,
    pub seeded: u32,
    pub shared: bool,
    pub exported: Option<Vec<u8>>,
    pub prompt: u64,
}

Fields§

§seq: Seq

The entry’s sequence while it is in the pool, and its name either way (a runtime never hands a handle out twice).

§tokens: Vec<u32>§pins: u32§last_used: u64§bytes: u64§seeded: u32

Lanes started from this entry.

§shared: bool

A copy of a live lane’s state, published for the requests that share its prefix: a lane seeded from it copies, never takes it over.

§exported: Option<Vec<u8>>

Some: the entry is out of the pool, held as the runtime’s lossless export of its tokens.len() tokens of state; its sequence is freed.

§prompt: u64

How much of tokens was the prompt of the lane that left the entry (the rest it generated); 0 where none is known.

Implementations§

Source§

impl CacheEntry

Source

pub fn share(&self, len: u64) -> bool

Whether len tokens are a real part of this entry.

Source

pub fn serves(&self, len: u64) -> bool

Whether a seed of len tokens is served from this entry: any, from one in the pool (a copy); a real part of it, from an export.

Source

pub fn holds_shared_prefix(&self) -> bool

An entry holds a prefix requests share when it is a lane’s state published for them, or has started two lanes or more: it goes after every entry that does not.

Source

pub fn covered_by(&self, other: &CacheEntry) -> bool

Whether other serves what this entry does: its tokens begin with all of this entry’s, or all but a share of them when it was used later.

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.