pub struct DictBuilder { /* private fields */ }Expand description
Accumulates (code, item, value) triples and serializes a Dict.
Implementations§
Source§impl DictBuilder
impl DictBuilder
pub fn new() -> Self
Sourcepub fn insert(&mut self, code: &[u8], item: &[u8], value: u64)
pub fn insert(&mut self, code: &[u8], item: &[u8], value: u64)
Add code → (item, value). A code may be inserted many times (one per
item). Insertion order across codes does not matter (the builder
groups + sorts); within a code, items are stored sorted by value
descending, then item bytes — so position 0 is the top-scoring item
and the output is fully deterministic.
pub fn finish(self) -> Vec<u8> ⓘ
Trait Implementations§
Source§impl Default for DictBuilder
impl Default for DictBuilder
Source§fn default() -> DictBuilder
fn default() -> DictBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for DictBuilder
impl RefUnwindSafe for DictBuilder
impl Send for DictBuilder
impl Sync for DictBuilder
impl Unpin for DictBuilder
impl UnsafeUnpin for DictBuilder
impl UnwindSafe for DictBuilder
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