BTreeTrait

Trait BTreeTrait 

Source
pub trait BTreeTrait {
    type Elem: Debug + HasLength + Sliceable + Mergeable + TryInsert + CanRemove;
    type Cache: Debug + Default + Clone + Eq;
    type CacheDiff: Debug + Default + CanRemove;

    const USE_DIFF: bool = true;

    // Required methods
    fn calc_cache_internal(
        cache: &mut Self::Cache,
        caches: &[Child<Self>],
    ) -> Self::CacheDiff;
    fn apply_cache_diff(cache: &mut Self::Cache, diff: &Self::CacheDiff);
    fn merge_cache_diff(diff1: &mut Self::CacheDiff, diff2: &Self::CacheDiff);
    fn get_elem_cache(elem: &Self::Elem) -> Self::Cache;
    fn new_cache_to_diff(cache: &Self::Cache) -> Self::CacheDiff;
    fn sub_cache(
        cache_lhs: &Self::Cache,
        cache_rhs: &Self::Cache,
    ) -> Self::CacheDiff;
}
Expand description

Elem should has length. offset in search result should always >= Elem.rle_len()

Provided Associated Constants§

Source

const USE_DIFF: bool = true

Required Associated Types§

Source

type Elem: Debug + HasLength + Sliceable + Mergeable + TryInsert + CanRemove

Sometime an [Elem] with length of 0, but it’s not empty.

The empty [Elem]s are the ones that can be safely ignored.

Source

type Cache: Debug + Default + Clone + Eq

Source

type CacheDiff: Debug + Default + CanRemove

Required Methods§

Source

fn calc_cache_internal( cache: &mut Self::Cache, caches: &[Child<Self>], ) -> Self::CacheDiff

If diff.is_some, return value should be some too

Source

fn apply_cache_diff(cache: &mut Self::Cache, diff: &Self::CacheDiff)

Source

fn merge_cache_diff(diff1: &mut Self::CacheDiff, diff2: &Self::CacheDiff)

Source

fn get_elem_cache(elem: &Self::Elem) -> Self::Cache

Source

fn new_cache_to_diff(cache: &Self::Cache) -> Self::CacheDiff

Source

fn sub_cache( cache_lhs: &Self::Cache, cache_rhs: &Self::Cache, ) -> Self::CacheDiff

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.

Implementors§