pub trait Unordered: Send + Sync {
type Value: Send + Sync;
type Cursor<'a>: Cursor<Value = Self::Value>
where Self: 'a;
// Required methods
fn get<'a>(
&'a self,
key: &[u8],
) -> impl Iterator<Item = &'a Self::Value> + Send + 'a
where Self::Value: 'a;
fn get_mut<'a>(&'a mut self, key: &[u8]) -> Option<Self::Cursor<'a>>;
fn get_mut_or_insert<'a>(
&'a mut self,
key: &[u8],
value: Self::Value,
) -> Option<Self::Cursor<'a>>;
fn insert(&mut self, key: &[u8], value: Self::Value);
fn insert_and_retain(
&mut self,
key: &[u8],
value: Self::Value,
should_retain: impl Fn(&Self::Value) -> bool,
);
fn remove(&mut self, key: &[u8]);
// Provided method
fn retain(
&mut self,
key: &[u8],
should_retain: impl Fn(&Self::Value) -> bool,
) { ... }
}Expand description
A trait defining the operations provided by a memory-efficient index that maps translated keys to arbitrary values, with no ordering assumed over the key space.
Required Associated Types§
Required Methods§
Sourcefn get<'a>(
&'a self,
key: &[u8],
) -> impl Iterator<Item = &'a Self::Value> + Send + 'awhere
Self::Value: 'a,
fn get<'a>(
&'a self,
key: &[u8],
) -> impl Iterator<Item = &'a Self::Value> + Send + 'awhere
Self::Value: 'a,
Returns an iterator over all values associated with a translated key.
Sourcefn get_mut<'a>(&'a mut self, key: &[u8]) -> Option<Self::Cursor<'a>>
fn get_mut<'a>(&'a mut self, key: &[u8]) -> Option<Self::Cursor<'a>>
Provides mutable access to the values associated with a translated key, if the key exists.
Sourcefn get_mut_or_insert<'a>(
&'a mut self,
key: &[u8],
value: Self::Value,
) -> Option<Self::Cursor<'a>>
fn get_mut_or_insert<'a>( &'a mut self, key: &[u8], value: Self::Value, ) -> Option<Self::Cursor<'a>>
Provides mutable access to the values associated with a translated key (if the key exists),
otherwise inserts a new value and returns None.
Sourcefn insert(&mut self, key: &[u8], value: Self::Value)
fn insert(&mut self, key: &[u8], value: Self::Value)
Inserts a new value for the translated key.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".