Trait mtbl::Read
[−]
[src]
pub trait Read { fn raw_mtbl_source(&self) -> &*const mtbl_source; fn get<T>(&self, key: T) -> Option<Vec<u8>> where Self: Sized, T: AsRef<[u8]> { ... } fn iter(&self) -> Iter { ... } fn get_prefix<T>(&self, prefix: T) -> Iter where Self: Sized, T: AsRef<[u8]> { ... } fn get_range<T, U>(&self, key0: T, key1: U) -> Iter where Self: Sized, T: AsRef<[u8]>, U: AsRef<[u8]> { ... } }
A trait for objects that can read keys from an MTBL file.
A Read is accessed like a sorted map, with each key mapping to one value. Keys and values are both byte sequences, passed around as slices or vectors. Because it's a sorted map, you can access not just via an exact key but also by a key prefix or range.
Required Methods
fn raw_mtbl_source(&self) -> &*const mtbl_source
Get the internal mtbl_source pointer.
Provided Methods
fn get<T>(&self, key: T) -> Option<Vec<u8>> where Self: Sized, T: AsRef<[u8]>
Get the value of a key, if it's present.
fn iter(&self) -> Iter
Get an iterator over all keys and values.
fn get_prefix<T>(&self, prefix: T) -> Iter where Self: Sized, T: AsRef<[u8]>
Get an iterator over all keys and values where the key starts with the given prefix.
fn get_range<T, U>(&self, key0: T, key1: U) -> Iter where Self: Sized, T: AsRef<[u8]>, U: AsRef<[u8]>
Get an iterator over all keys and values, where the keys are between key0 and key1 (inclusive).
Trait Implementations
impl<'a> IntoIterator for &'a Read
[src]
type Item = (Vec<u8>, Vec<u8>)
The type of the elements being iterated over.
type IntoIter = Iter<'a>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Iter<'a>
Creates an iterator from a value. Read more