Trait tantivy::termdict::TermStreamer
[−]
[src]
pub trait TermStreamer: Sized { fn advance(&mut self) -> bool; fn key(&self) -> &[u8]; fn term_ord(&self) -> TermOrdinal; fn value(&self) -> &TermInfo; fn next(&mut self) -> Option<(&[u8], &TermInfo)> { ... } }
TermStreamer
acts as a cursor over a range of terms of a segment.
Terms are guaranteed to be sorted.
Required Methods
fn advance(&mut self) -> bool
Advance position the stream on the next item.
Before the first call to .advance()
, the stream
is an unitialized state.
fn key(&self) -> &[u8]
Accesses the current key.
.key()
should return the key that was returned
by the .next()
method.
If the end of the stream as been reached, and .next()
has been called and returned None
, .key()
remains
the value of the last key encountered.
Before any call to .next()
, .key()
returns an empty array.
fn term_ord(&self) -> TermOrdinal
Returns the TermOrdinal
of the given term.
May panic if the called as .advance()
as never
been called before.
fn value(&self) -> &TermInfo
Accesses the current value.
Calling .value()
after the end of the stream will return the
last .value()
encountered.
Panics
Calling .value()
before the first call to .advance()
returns
V::default()
.
Provided Methods
Implementors
impl<'a> TermStreamer for TermStreamerImpl<'a>