pub struct DictionaryEncoder { /* private fields */ }Expand description
Streaming encoder for (timestamp_ms, string_value) pairs.
Assign compact u32 codes to unique string values and build a
DictionaryBlock via finish.
Implementations§
Source§impl DictionaryEncoder
impl DictionaryEncoder
Sourcepub fn encode(&mut self, timestamp: i64, value: &str) -> TsdbResult<u32>
pub fn encode(&mut self, timestamp: i64, value: &str) -> TsdbResult<u32>
Encode a single (timestamp_ms, value) sample.
Returns the assigned code for value.
Sourcepub fn finish(self) -> DictionaryBlock
pub fn finish(self) -> DictionaryBlock
Consume the encoder and produce a DictionaryBlock.
Sourcepub fn cardinality(&self) -> usize
pub fn cardinality(&self) -> usize
Number of distinct values seen so far.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DictionaryEncoder
impl RefUnwindSafe for DictionaryEncoder
impl Send for DictionaryEncoder
impl Sync for DictionaryEncoder
impl Unpin for DictionaryEncoder
impl UnsafeUnpin for DictionaryEncoder
impl UnwindSafe for DictionaryEncoder
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more