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§
Required Associated Types§
Sourcetype Elem: Debug + HasLength + Sliceable + Mergeable + TryInsert + CanRemove
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.
type Cache: Debug + Default + Clone + Eq
type CacheDiff: Debug + Default + CanRemove
Required Methods§
Sourcefn calc_cache_internal(
cache: &mut Self::Cache,
caches: &[Child<Self>],
) -> Self::CacheDiff
fn calc_cache_internal( cache: &mut Self::Cache, caches: &[Child<Self>], ) -> Self::CacheDiff
If diff.is_some, return value should be some too
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
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.