pub enum TokenAction {
Continue,
Stop,
}Expand description
A guest’s verdict on each streamed token, returned from its on_token
export.
Variants§
Continue
Keep generating.
Stop
Stop generating now.
A token or two may still arrive after this, because the verdict has to travel back to the thread doing the generating.
Implementations§
Source§impl TokenAction
impl TokenAction
Sourcepub fn from_i32(v: i32) -> Self
pub fn from_i32(v: i32) -> Self
Decode the raw i32 a guest’s on_token export returns.
Anything that is not an explicit Continue reads as Stop. A guest
returning a value this crate does not recognise is malfunctioning, and
the safe reading of a malfunctioning guest is “stop”, never “keep
spending tokens” — the same fail-closed posture as the capability checks.
Trait Implementations§
Source§impl Clone for TokenAction
impl Clone for TokenAction
Source§fn clone(&self) -> TokenAction
fn clone(&self) -> TokenAction
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 moreimpl Copy for TokenAction
Source§impl Debug for TokenAction
impl Debug for TokenAction
impl Eq for TokenAction
Source§impl PartialEq for TokenAction
impl PartialEq for TokenAction
impl StructuralPartialEq for TokenAction
Auto Trait Implementations§
impl Freeze for TokenAction
impl RefUnwindSafe for TokenAction
impl Send for TokenAction
impl Sync for TokenAction
impl Unpin for TokenAction
impl UnsafeUnpin for TokenAction
impl UnwindSafe for TokenAction
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