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: bool
is 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
impl StructuralPartialEq for LlamaTokenDataArray
Auto Trait Implementations§
impl Freeze for LlamaTokenDataArray
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