pub struct DraftBlock { /* private fields */ }Expand description
A block of drafted tokens plus, per position, the distribution that position was drawn from.
tokens and dists are the same length by construction: the
verification rule needs q for every token it might have to reject,
so a block that carried tokens without distributions could not be
verified losslessly at all.
Implementations§
Source§impl DraftBlock
impl DraftBlock
pub fn empty() -> Self
Sourcepub fn new(tokens: Vec<usize>, dists: Vec<DraftDist>) -> Self
pub fn new(tokens: Vec<usize>, dists: Vec<DraftDist>) -> Self
Panics if the two vectors disagree in length – an unverifiable block is a programming error in the drafter, not a runtime condition to degrade around.
Sourcepub fn deterministic(tokens: Vec<usize>) -> Self
pub fn deterministic(tokens: Vec<usize>) -> Self
A block from a drafter that has no distribution to offer: every position is reported as certain. Correct (and lossless) for a lookup drafter; wrong for a model-based one, which must report its real softmax.
pub fn tokens(&self) -> &[usize]
pub fn dists(&self) -> &[DraftDist]
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for DraftBlock
impl Clone for DraftBlock
Source§fn clone(&self) -> DraftBlock
fn clone(&self) -> DraftBlock
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DraftBlock
impl Debug for DraftBlock
Source§impl Default for DraftBlock
impl Default for DraftBlock
Source§fn default() -> DraftBlock
fn default() -> DraftBlock
Returns the “default value” for a type. Read more
Source§impl PartialEq for DraftBlock
impl PartialEq for DraftBlock
impl StructuralPartialEq for DraftBlock
Auto Trait Implementations§
impl Freeze for DraftBlock
impl RefUnwindSafe for DraftBlock
impl Send for DraftBlock
impl Sync for DraftBlock
impl Unpin for DraftBlock
impl UnsafeUnpin for DraftBlock
impl UnwindSafe for DraftBlock
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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