pub trait Unordered: Send + Sync {
type Value: Eq + 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_prune(
&mut self,
key: &[u8],
value: Self::Value,
predicate: impl Fn(&Self::Value) -> bool,
);
fn prune(&mut self, key: &[u8], predicate: impl Fn(&Self::Value) -> bool);
fn remove(&mut self, key: &[u8]);
}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 at the current position.
Sourcefn insert_and_prune(
&mut self,
key: &[u8],
value: Self::Value,
predicate: impl Fn(&Self::Value) -> bool,
)
fn insert_and_prune( &mut self, key: &[u8], value: Self::Value, predicate: impl Fn(&Self::Value) -> bool, )
Insert a value at the given translated key, and prune any values that are no longer valid.
If the value is prunable, it will not be inserted.
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.