Struct fst::MapBuilder
[−]
[src]
pub struct MapBuilder<W>(_);
Methods
impl MapBuilder<Vec<u8>>
[src]
fn memory() -> Self
Create a builder that builds a map in memory.
impl<W: Write> MapBuilder<W>
[src]
fn new(wtr: W) -> Result<MapBuilder<W>>
Create a builder that builds a map by writing it to wtr
in a
streaming fashion.
fn insert<K: AsRef<[u8]>>(&mut self, key: K, val: u64) -> Result<()>
Insert a new key-value pair into the map.
If a key is inserted that is less than or equal to any previous key added, then an error is returned. Similarly, if there was a problem writing to the underlying writer, an error is returned.
fn extend_iter<K, I>(&mut self, iter: I) -> Result<()> where K: AsRef<[u8]>, I: IntoIterator<Item=(K, u64)>
Calls insert on each item in the iterator.
If an error occurred while adding an element, processing is stopped and the error is returned.
fn extend_stream<'f, I, S>(&mut self, stream: I) -> Result<()> where I: for<'a> IntoStream<'a, Into=S, Item=(&'a [u8], u64)>, S: 'f + for<'a> Stream<'a, Item=(&'a [u8], u64)>
Calls insert on each item in the stream.
Note that unlike extend_iter
, this is not generic on the items in
the stream.
fn finish(self) -> Result<()>
Finishes the construction of the map and flushes the underlying
writer. After completion, the data written to W
may be read using
one of Map
's constructor methods.
fn into_inner(self) -> Result<W>
Just like finish
, except it returns the underlying writer after
flushing it.