pub trait Ordered:
Unordered
+ Send
+ Sync {
type Iterator<'a>: Iterator<Item = &'a Self::Value> + Send
where Self: 'a;
// Required methods
fn prev_translated_key<'a>(
&'a self,
key: &[u8],
) -> Option<(Self::Iterator<'a>, bool)>
where Self::Value: 'a;
fn next_translated_key<'a>(
&'a self,
key: &[u8],
) -> Option<(Self::Iterator<'a>, bool)>
where Self::Value: 'a;
fn first_translated_key<'a>(&'a self) -> Option<Self::Iterator<'a>>
where Self::Value: 'a;
fn last_translated_key<'a>(&'a self) -> Option<Self::Iterator<'a>>
where Self::Value: 'a;
}Expand description
A trait defining the additional operations provided by a memory-efficient index that allows ordered traversal of the indexed keys.
Required Associated Types§
Required Methods§
fn prev_translated_key<'a>(
&'a self,
key: &[u8],
) -> Option<(Self::Iterator<'a>, bool)>where
Self::Value: 'a,
Sourcefn next_translated_key<'a>(
&'a self,
key: &[u8],
) -> Option<(Self::Iterator<'a>, bool)>where
Self::Value: 'a,
fn next_translated_key<'a>(
&'a self,
key: &[u8],
) -> Option<(Self::Iterator<'a>, bool)>where
Self::Value: 'a,
For example, if the translator is looking only at the first byte of a key, and the index
contains values for translated keys 0b, 1c, and 2d, then get_next([0b, 01, 02, ...]) would
return the values associated with 1c, get_next([2a, 01, 02, ...]) would return the values
associated with 2d, and get_next([2d]) would “cycle around” to the values associated with
0b, returning true for the bool. Because values associated with the same translated key can
appear in any order, keys with the same first byte in this example would need to be ordered
by the caller if a full ordering over the untranslated keyspace is desired.
fn first_translated_key<'a>(&'a self) -> Option<Self::Iterator<'a>>where
Self::Value: 'a,
fn last_translated_key<'a>(&'a self) -> Option<Self::Iterator<'a>>where
Self::Value: 'a,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.