pub trait Tree {
type TKey: Ord;
type TValue;
Show 18 methods
// Required methods
fn query_exact<K>(
&self,
key: &K,
) -> TreeQueryExactResult<'_, Self::TKey, Self::TValue>
where Self::TKey: Compare<K>;
fn query_exact_mut<K>(
&mut self,
key: &K,
) -> TreeQueryExactMutResult<'_, Self::TKey, Self::TValue>
where Self::TKey: Compare<K>;
fn query_less_than<K>(
&self,
key: &K,
max_count: Option<NonZeroU8>,
) -> impl TreeQueryResult<'_, Self::TKey, Self::TValue>
where Self::TKey: Compare<K>;
fn query_less_than_mut<K>(
&mut self,
key: &K,
max_count: Option<NonZeroU8>,
) -> impl TreeQueryMutResult<'_, Self::TKey, Self::TValue>
where Self::TKey: Compare<K>;
fn query_less_than_or_equal<K>(
&self,
key: &K,
max_count: Option<NonZeroU8>,
) -> impl TreeQueryResult<'_, Self::TKey, Self::TValue>
where Self::TKey: Compare<K>;
fn query_less_than_or_equal_mut<K>(
&mut self,
key: &K,
max_count: Option<NonZeroU8>,
) -> impl TreeQueryMutResult<'_, Self::TKey, Self::TValue>
where Self::TKey: Compare<K>;
fn query_greater_than<K>(
&self,
key: &K,
max_count: Option<NonZeroU8>,
) -> impl TreeQueryResult<'_, Self::TKey, Self::TValue>
where Self::TKey: Compare<K>;
fn query_greater_than_mut<K>(
&mut self,
key: &K,
max_count: Option<NonZeroU8>,
) -> impl TreeQueryMutResult<'_, Self::TKey, Self::TValue>
where Self::TKey: Compare<K>;
fn query_greater_than_or_equal<K>(
&self,
key: &K,
max_count: Option<NonZeroU8>,
) -> impl TreeQueryResult<'_, Self::TKey, Self::TValue>
where Self::TKey: Compare<K>;
fn query_greater_than_or_equal_mut<K>(
&mut self,
key: &K,
max_count: Option<NonZeroU8>,
) -> impl TreeQueryMutResult<'_, Self::TKey, Self::TValue>
where Self::TKey: Compare<K>;
fn query_range_exclusive<K>(
&self,
left: &K,
right: &K,
) -> impl TreeQueryResult<'_, Self::TKey, Self::TValue>
where Self::TKey: Compare<K>;
fn query_range_exclusive_mut<K>(
&mut self,
left: &K,
right: &K,
) -> impl TreeQueryMutResult<'_, Self::TKey, Self::TValue>
where Self::TKey: Compare<K>;
fn query_range_inclusive<K>(
&self,
left: &K,
right: &K,
) -> impl TreeQueryResult<'_, Self::TKey, Self::TValue>
where Self::TKey: Compare<K>;
fn query_range_inclusive_mut<K>(
&mut self,
left: &K,
right: &K,
) -> impl TreeQueryMutResult<'_, Self::TKey, Self::TValue>
where Self::TKey: Compare<K>;
fn query_range_left_inclusive<K>(
&self,
left: &K,
right: &K,
) -> impl TreeQueryResult<'_, Self::TKey, Self::TValue>
where Self::TKey: Compare<K>;
fn query_range_left_inclusive_mut<K>(
&mut self,
left: &K,
right: &K,
) -> impl TreeQueryMutResult<'_, Self::TKey, Self::TValue>
where Self::TKey: Compare<K>;
fn query_range_right_inclusive<K>(
&self,
left: &K,
right: &K,
) -> impl TreeQueryResult<'_, Self::TKey, Self::TValue>
where Self::TKey: Compare<K>;
fn query_range_right_inclusive_mut<K>(
&mut self,
left: &K,
right: &K,
) -> impl TreeQueryMutResult<'_, Self::TKey, Self::TValue>
where Self::TKey: Compare<K>;
}
Expand description
Abstract trait for tree-like data structures.
Required Associated Types§
Required Methods§
Sourcefn query_exact<K>(
&self,
key: &K,
) -> TreeQueryExactResult<'_, Self::TKey, Self::TValue>
fn query_exact<K>( &self, key: &K, ) -> TreeQueryExactResult<'_, Self::TKey, Self::TValue>
Searches the tree for the exact match.
Sourcefn query_exact_mut<K>(
&mut self,
key: &K,
) -> TreeQueryExactMutResult<'_, Self::TKey, Self::TValue>
fn query_exact_mut<K>( &mut self, key: &K, ) -> TreeQueryExactMutResult<'_, Self::TKey, Self::TValue>
The mutable version of Tree::query_exact
.
Sourcefn query_less_than<K>(
&self,
key: &K,
max_count: Option<NonZeroU8>,
) -> impl TreeQueryResult<'_, Self::TKey, Self::TValue>
fn query_less_than<K>( &self, key: &K, max_count: Option<NonZeroU8>, ) -> impl TreeQueryResult<'_, Self::TKey, Self::TValue>
Searches the tree for the key-value pairs less than the passed key. These will be returned in descending order starting from the gratest found element.
If max_count
is None
, all key-value pairs less than the passed key will be returned.
If max_count
is Some(n)
, at most n
key-value pairs will be returned.
Sourcefn query_less_than_mut<K>(
&mut self,
key: &K,
max_count: Option<NonZeroU8>,
) -> impl TreeQueryMutResult<'_, Self::TKey, Self::TValue>
fn query_less_than_mut<K>( &mut self, key: &K, max_count: Option<NonZeroU8>, ) -> impl TreeQueryMutResult<'_, Self::TKey, Self::TValue>
The mutable version of Tree::query_less_than
.
Sourcefn query_less_than_or_equal<K>(
&self,
key: &K,
max_count: Option<NonZeroU8>,
) -> impl TreeQueryResult<'_, Self::TKey, Self::TValue>
fn query_less_than_or_equal<K>( &self, key: &K, max_count: Option<NonZeroU8>, ) -> impl TreeQueryResult<'_, Self::TKey, Self::TValue>
Searches the tree for the key-value pairs less than or equal to the passed key. These will be returned in descending order starting from the gratest found element.
If max_count
is None
, all key-value pairs less than or equal to the passed key will be returned.
If max_count
is Some(n)
, at most n
key-value pairs will be returned.
Sourcefn query_less_than_or_equal_mut<K>(
&mut self,
key: &K,
max_count: Option<NonZeroU8>,
) -> impl TreeQueryMutResult<'_, Self::TKey, Self::TValue>
fn query_less_than_or_equal_mut<K>( &mut self, key: &K, max_count: Option<NonZeroU8>, ) -> impl TreeQueryMutResult<'_, Self::TKey, Self::TValue>
The mutable version of Tree::query_less_than_or_equal
.
Sourcefn query_greater_than<K>(
&self,
key: &K,
max_count: Option<NonZeroU8>,
) -> impl TreeQueryResult<'_, Self::TKey, Self::TValue>
fn query_greater_than<K>( &self, key: &K, max_count: Option<NonZeroU8>, ) -> impl TreeQueryResult<'_, Self::TKey, Self::TValue>
Searches the tree for the key-value pairs greater than the passed key. These will be returned in ascending order starting from the smallest found element.
If max_count
is None
, all key-value pairs greater than the passed key will be returned.
If max_count
is Some(n)
, at most n
key-value pairs will be returned.
Sourcefn query_greater_than_mut<K>(
&mut self,
key: &K,
max_count: Option<NonZeroU8>,
) -> impl TreeQueryMutResult<'_, Self::TKey, Self::TValue>
fn query_greater_than_mut<K>( &mut self, key: &K, max_count: Option<NonZeroU8>, ) -> impl TreeQueryMutResult<'_, Self::TKey, Self::TValue>
The mutable version of Tree::query_greater_than
.
Sourcefn query_greater_than_or_equal<K>(
&self,
key: &K,
max_count: Option<NonZeroU8>,
) -> impl TreeQueryResult<'_, Self::TKey, Self::TValue>
fn query_greater_than_or_equal<K>( &self, key: &K, max_count: Option<NonZeroU8>, ) -> impl TreeQueryResult<'_, Self::TKey, Self::TValue>
Searches the tree for the key-value pairs greater than or equal to the passed key. These will be returned in ascending order starting from the smallest found element.
If max_count
is None
, all key-value pairs greater than or equal to the passed key will be returned.
If max_count
is Some(n)
, at most n
key-value pairs will be returned.
Sourcefn query_greater_than_or_equal_mut<K>(
&mut self,
key: &K,
max_count: Option<NonZeroU8>,
) -> impl TreeQueryMutResult<'_, Self::TKey, Self::TValue>
fn query_greater_than_or_equal_mut<K>( &mut self, key: &K, max_count: Option<NonZeroU8>, ) -> impl TreeQueryMutResult<'_, Self::TKey, Self::TValue>
The mutable version of Tree::query_greater_than_or_equal
.
Sourcefn query_range_exclusive<K>(
&self,
left: &K,
right: &K,
) -> impl TreeQueryResult<'_, Self::TKey, Self::TValue>
fn query_range_exclusive<K>( &self, left: &K, right: &K, ) -> impl TreeQueryResult<'_, Self::TKey, Self::TValue>
Searches the tree for the key-value pairs in the range (left, right)
,
i.e. with endpoints excluded.
Sourcefn query_range_exclusive_mut<K>(
&mut self,
left: &K,
right: &K,
) -> impl TreeQueryMutResult<'_, Self::TKey, Self::TValue>
fn query_range_exclusive_mut<K>( &mut self, left: &K, right: &K, ) -> impl TreeQueryMutResult<'_, Self::TKey, Self::TValue>
The mutable version of Tree::query_range_exclusive
.
Sourcefn query_range_inclusive<K>(
&self,
left: &K,
right: &K,
) -> impl TreeQueryResult<'_, Self::TKey, Self::TValue>
fn query_range_inclusive<K>( &self, left: &K, right: &K, ) -> impl TreeQueryResult<'_, Self::TKey, Self::TValue>
Searches the tree for the key-value pairs in the range [left, right]
,
i.e. with endpoints included.
Sourcefn query_range_inclusive_mut<K>(
&mut self,
left: &K,
right: &K,
) -> impl TreeQueryMutResult<'_, Self::TKey, Self::TValue>
fn query_range_inclusive_mut<K>( &mut self, left: &K, right: &K, ) -> impl TreeQueryMutResult<'_, Self::TKey, Self::TValue>
The mutable version of Tree::query_range_inclusive
.
Sourcefn query_range_left_inclusive<K>(
&self,
left: &K,
right: &K,
) -> impl TreeQueryResult<'_, Self::TKey, Self::TValue>
fn query_range_left_inclusive<K>( &self, left: &K, right: &K, ) -> impl TreeQueryResult<'_, Self::TKey, Self::TValue>
Searches the tree for the key-value pairs in the range [left, right)
,
i.e. with the left endpoint included and the right endpoint excluded.
Sourcefn query_range_left_inclusive_mut<K>(
&mut self,
left: &K,
right: &K,
) -> impl TreeQueryMutResult<'_, Self::TKey, Self::TValue>
fn query_range_left_inclusive_mut<K>( &mut self, left: &K, right: &K, ) -> impl TreeQueryMutResult<'_, Self::TKey, Self::TValue>
The mutable version of Tree::query_range_left_inclusive
.
Sourcefn query_range_right_inclusive<K>(
&self,
left: &K,
right: &K,
) -> impl TreeQueryResult<'_, Self::TKey, Self::TValue>
fn query_range_right_inclusive<K>( &self, left: &K, right: &K, ) -> impl TreeQueryResult<'_, Self::TKey, Self::TValue>
Searches the tree for the key-value pairs in the range (left, right]
,
i.e. with the right endpoint included and the left endpoint excluded.
Sourcefn query_range_right_inclusive_mut<K>(
&mut self,
left: &K,
right: &K,
) -> impl TreeQueryMutResult<'_, Self::TKey, Self::TValue>
fn query_range_right_inclusive_mut<K>( &mut self, left: &K, right: &K, ) -> impl TreeQueryMutResult<'_, Self::TKey, Self::TValue>
The mutable version of Tree::query_range_right_inclusive
.
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.