pub struct Range<'i>(pub Range<'i>);
Tuple Fields§
§0: Range<'i>
Implementations§
source§impl<'i> Range<'i>
impl<'i> Range<'i>
pub fn subtract_suffix(self, other: Self) -> Self
Methods from Deref<Target = Range<'i>>§
sourcepub fn nonempty(&self) -> Result<Range<'id, NonEmpty>, IndexingError>
pub fn nonempty(&self) -> Result<Range<'id, NonEmpty>, IndexingError>
Try to create a proof that the Range is nonempty; return
a Result
where the Ok
branch carries a non-empty Range.
sourcepub fn split_at(
&self,
index: usize
) -> (Range<'id, Unknown>, Range<'id, Unknown>, bool)
pub fn split_at(
&self,
index: usize
) -> (Range<'id, Unknown>, Range<'id, Unknown>, bool)
Split to length index
; if past the end, return false and clamp to the end
index
is a relative index.
sourcepub fn contains(&self, abs_index: usize) -> Option<Index<'id, NonEmpty>>
pub fn contains(&self, abs_index: usize) -> Option<Index<'id, NonEmpty>>
abs_index
is an absolute index
sourcepub fn subdivide(&self, n: usize) -> Subdivide<'id>
pub fn subdivide(&self, n: usize) -> Subdivide<'id>
Return an iterator that divides the range in n
parts, in as
even length chunks as possible.
sourcepub fn join<Q>(
&self,
other: Range<'id, Q>
) -> Result<Range<'id, <(P, Q) as ProofAdd>::Sum>, IndexingError>where
(P, Q): ProofAdd,
pub fn join<Q>(
&self,
other: Range<'id, Q>
) -> Result<Range<'id, <(P, Q) as ProofAdd>::Sum>, IndexingError>where
(P, Q): ProofAdd,
Join together two adjacent ranges (they must be exactly touching, and in left to right order).
sourcepub fn join_cover<Q>(
&self,
other: Range<'id, Q>
) -> Range<'id, <(P, Q) as ProofAdd>::Sum>where
(P, Q): ProofAdd,
pub fn join_cover<Q>(
&self,
other: Range<'id, Q>
) -> Range<'id, <(P, Q) as ProofAdd>::Sum>where
(P, Q): ProofAdd,
Extend the range to the end of other
, including any space in between
sourcepub fn join_cover_both<Q>(
&self,
other: Range<'id, Q>
) -> Range<'id, <(P, Q) as ProofAdd>::Sum>where
(P, Q): ProofAdd,
pub fn join_cover_both<Q>(
&self,
other: Range<'id, Q>
) -> Range<'id, <(P, Q) as ProofAdd>::Sum>where
(P, Q): ProofAdd,
Extend the range to start and end of other
, including any space in between
pub fn as_range(&self) -> Range<usize>
sourcepub fn frontiers(&self) -> (Range<'id, Unknown>, Range<'id, Unknown>)
pub fn frontiers(&self) -> (Range<'id, Unknown>, Range<'id, Unknown>)
Return two empty ranges, at the front and the back of the range respectively
sourcepub fn forward_by(&self, index: &mut Index<'id, NonEmpty>, offset: usize) -> bool
pub fn forward_by(&self, index: &mut Index<'id, NonEmpty>, offset: usize) -> bool
Increment index
, if doing so would still be before the end of the range
Return true
if the index was incremented.
sourcepub fn forward_range_by<Q>(
&self,
r: Range<'id, Q>,
offset: usize
) -> Range<'id, Unknown>
pub fn forward_range_by<Q>(
&self,
r: Range<'id, Q>,
offset: usize
) -> Range<'id, Unknown>
Increment r
, clamping to the end of self
.
pub fn no_proof(&self) -> Range<'id, Unknown>
sourcepub fn first(&self) -> Index<'id, P>
pub fn first(&self) -> Index<'id, P>
Return the first index in the range (The index is accessible if the range
is NonEmpty
).
sourcepub fn upper_middle(&self) -> Index<'id, P>
pub fn upper_middle(&self) -> Index<'id, P>
Return the middle index, rounding up.
Produces mid
where mid = start + len / 2
.
sourcepub fn lower_middle(&self) -> Index<'id, NonEmpty>
pub fn lower_middle(&self) -> Index<'id, NonEmpty>
Return the middle index, rounding down.
Produces mid
where mid = start + (len - 1)/ 2
.
pub fn last(&self) -> Index<'id, NonEmpty>
pub fn init(&self) -> Range<'id, Unknown>
pub fn advance_(&self) -> Result<Range<'id, NonEmpty>, IndexingError>
Trait Implementations§
source§impl<'i> Ord for Range<'i>
impl<'i> Ord for Range<'i>
source§impl<'i> PartialOrd<Range<'i>> for Range<'i>
impl<'i> PartialOrd<Range<'i>> for Range<'i>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl<'i> Copy for Range<'i>
impl<'i> Eq for Range<'i>
impl<'i> StructuralEq for Range<'i>
impl<'i> StructuralPartialEq for Range<'i>
Auto Trait Implementations§
impl<'i> RefUnwindSafe for Range<'i>
impl<'i> Send for Range<'i>
impl<'i> Sync for Range<'i>
impl<'i> Unpin for Range<'i>
impl<'i> UnwindSafe for Range<'i>
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.