#[repr(transparent)]pub struct LlamaToken(pub llama_token);Expand description
A safe wrapper for llama_token.
This struct wraps around a llama_token and implements various traits for safe usage, including
Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, and Hash. The Display trait
is also implemented to provide a simple way to format LlamaToken for printing.
Tuple Fields§
§0: llama_tokenImplementations§
Source§impl LlamaToken
impl LlamaToken
Sourcepub fn new(token_id: i32) -> Self
pub fn new(token_id: i32) -> Self
Creates a new LlamaToken from an i32.
This constructor allows you to easily create a LlamaToken from a raw integer value representing
the token’s ID. This is useful when interacting with external systems that provide token IDs as integers.
§Example
let token = LlamaToken::new(0);
assert_eq!(token, LlamaToken(0));§Parameters
token_id: The integer ID for the token.
§Returns
Returns a new instance of LlamaToken wrapping the provided token_id.
Trait Implementations§
Source§impl Clone for LlamaToken
impl Clone for LlamaToken
Source§fn clone(&self) -> LlamaToken
fn clone(&self) -> LlamaToken
Returns a duplicate of the value. Read more
1.0.0 · 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 LlamaToken
impl Debug for LlamaToken
Source§impl Display for LlamaToken
impl Display for LlamaToken
Source§impl Hash for LlamaToken
impl Hash for LlamaToken
Source§impl Ord for LlamaToken
impl Ord for LlamaToken
Source§fn cmp(&self, other: &LlamaToken) -> Ordering
fn cmp(&self, other: &LlamaToken) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for LlamaToken
impl PartialEq for LlamaToken
Source§impl PartialOrd for LlamaToken
impl PartialOrd for LlamaToken
impl Copy for LlamaToken
impl Eq for LlamaToken
impl StructuralPartialEq for LlamaToken
Auto Trait Implementations§
impl Freeze for LlamaToken
impl RefUnwindSafe for LlamaToken
impl Send for LlamaToken
impl Sync for LlamaToken
impl Unpin for LlamaToken
impl UnsafeUnpin for LlamaToken
impl UnwindSafe for LlamaToken
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