Struct llama_cpp_2::token::data_array::LlamaTokenDataArray   
source · pub struct LlamaTokenDataArray {
    pub data: Vec<LlamaTokenData>,
    pub sorted: bool,
}Expand description
a safe wrapper around llama_token_data_array.
Fields§
§data: Vec<LlamaTokenData>the underlying data
sorted: boolis the data sorted?
Implementations§
source§impl LlamaTokenDataArray
 
impl LlamaTokenDataArray
sourcepub fn new(data: Vec<LlamaTokenData>, sorted: bool) -> Self
 
pub fn new(data: Vec<LlamaTokenData>, sorted: bool) -> Self
Create a new LlamaTokenDataArray from a vector and weather or not the data is sorted.
let array = LlamaTokenDataArray::new(vec![
        LlamaTokenData::new(LlamaToken(0), 0.0, 0.0),
        LlamaTokenData::new(LlamaToken(1), 0.1, 0.1)
   ], false);
assert_eq!(array.data.len(), 2);
assert_eq!(array.sorted, false);sourcepub fn from_iter<T>(data: T, sorted: bool) -> LlamaTokenDataArraywhere
    T: IntoIterator<Item = LlamaTokenData>,
 
pub fn from_iter<T>(data: T, sorted: bool) -> LlamaTokenDataArraywhere
    T: IntoIterator<Item = LlamaTokenData>,
Create a new LlamaTokenDataArray from an iterator and weather or not the data is sorted.
let array = LlamaTokenDataArray::from_iter([
    LlamaTokenData::new(LlamaToken(0), 0.0, 0.0),
    LlamaTokenData::new(LlamaToken(1), 0.1, 0.1)
], false);
assert_eq!(array.data.len(), 2);
assert_eq!(array.sorted, false);Trait Implementations§
source§impl Clone for LlamaTokenDataArray
 
impl Clone for LlamaTokenDataArray
source§fn clone(&self) -> LlamaTokenDataArray
 
fn clone(&self) -> LlamaTokenDataArray
Returns a copy 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 LlamaTokenDataArray
 
impl Debug for LlamaTokenDataArray
source§impl PartialEq for LlamaTokenDataArray
 
impl PartialEq for LlamaTokenDataArray
source§fn eq(&self, other: &LlamaTokenDataArray) -> bool
 
fn eq(&self, other: &LlamaTokenDataArray) -> bool
This method tests for 
self and other values to be equal, and is used
by ==.impl StructuralPartialEq for LlamaTokenDataArray
Auto Trait Implementations§
impl RefUnwindSafe for LlamaTokenDataArray
impl Send for LlamaTokenDataArray
impl Sync for LlamaTokenDataArray
impl Unpin for LlamaTokenDataArray
impl UnwindSafe for LlamaTokenDataArray
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