Type Alias bao_tree::ChunkRangesRef

source ·
pub type ChunkRangesRef = RangeSetRef<ChunkNum>;
Expand description

A referenceable set of chunk ranges

ChunkRanges implements AsRef.

Aliased Type§

struct ChunkRangesRef(/* private fields */);

Implementations§

source§

impl<T> RangeSetRef<T>

source

pub const fn empty() -> &'static RangeSetRef<T>

Create a new range set reference for an empty range set

source

pub const fn single(value: &T) -> &RangeSetRef<T>

Create a new range set reference for a single value

source

pub fn new(boundaries: &[T]) -> Option<&RangeSetRef<T>>where T: Ord,

Create a new range set reference

This performs a check that the boundaries are strictly sorted. If you want to avoid this check, use new_unchecked (behind a feature flag because it is unsafe)

source

pub fn split(&self, at: T) -> (&RangeSetRef<T>, &RangeSetRef<T>)where T: Ord,

Split this range set into two parts left, right at position at, so that left is identical to self for all x < at and right is identical to self for all x >= at.

More precisely: contains(left, x) == contains(ranges, x) for x < at contains(right, x) == contains(ranges, x) for x >= at

This is not the same as limiting the ranges to the left or right of at, but it is much faster. It requires just a binary search and no allocations.

source

pub const fn new_unchecked(boundaries: &[T]) -> &RangeSetRef<T>

Create a new range set reference without checking that the boundaries are strictly sorted.

source

pub const fn boundaries(&self) -> &[T]

The boundaries of the range set, guaranteed to be strictly sorted

source

pub fn contains(&self, value: &T) -> boolwhere T: Ord,

true if the value is contained in the range set

source

pub const fn is_empty(&self) -> bool

true if the range set is empty

source

pub fn is_all(&self) -> boolwhere T: RangeSetEntry,

true if the range set contains all values

source

pub fn intersects(&self, that: &RangeSetRef<T>) -> boolwhere T: Ord,

true if this range set intersects from another range set

This is just the opposite of is_disjoint, but is provided for better discoverability.

source

pub fn is_disjoint(&self, that: &RangeSetRef<T>) -> boolwhere T: Ord,

true if this range set is disjoint from another range set

source

pub fn is_subset(&self, that: &RangeSetRef<T>) -> boolwhere T: Ord,

true if this range set is a superset of another range set

A range set is considered to be a superset of itself

source

pub fn is_superset(&self, that: &RangeSetRef<T>) -> boolwhere T: Ord,

true if this range set is a subset of another range set

A range set is considered to be a subset of itself

source

pub fn iter(&self) -> Iter<'_, T>

iterate over all ranges in this range set

source

pub fn intersection<A>(&self, that: &RangeSetRef<T>) -> RangeSet<A>where A: Array<Item = T>, T: Ord + Clone,

intersection

source

pub fn union<A>(&self, that: &RangeSetRef<T>) -> RangeSet<A>where A: Array<Item = T>, T: Ord + Clone,

union

source

pub fn difference<A>(&self, that: &RangeSetRef<T>) -> RangeSet<A>where A: Array<Item = T>, T: Ord + Clone,

difference

source

pub fn symmetric_difference<A>(&self, that: &RangeSetRef<T>) -> RangeSet<A>where A: Array<Item = T>, T: Ord + Clone,

symmetric difference (xor)

Trait Implementations§

source§

impl<T> Debug for RangeSetRef<T>where T: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<T> Ord for RangeSetRef<T>where T: Ord,

source§

fn cmp(&self, other: &RangeSetRef<T>) -> Ordering

This method returns an Ordering between self and other. Read more
source§

impl<T> PartialEq<RangeSetRef<T>> for RangeSetRef<T>where T: PartialEq<T>,

source§

fn eq(&self, other: &RangeSetRef<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> PartialOrd<RangeSetRef<T>> for RangeSetRef<T>where T: PartialOrd<T>,

source§

fn partial_cmp(&self, other: &RangeSetRef<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T> Eq for RangeSetRef<T>where T: Eq,

source§

impl<T> StructuralEq for RangeSetRef<T>

source§

impl<T> StructuralPartialEq for RangeSetRef<T>