pub struct Range<'a, T: 'a> { /* private fields */ }
Expand description
Immutable sub-range of GapBuffer
This struct is created by Slice::range
.
Implementations
sourceimpl<'a, T: 'a> Range<'a, T>
impl<'a, T: 'a> Range<'a, T>
sourcepub fn get(&self, index: usize) -> Option<&'a T>
pub fn get(&self, index: usize) -> Option<&'a T>
Returns a reference to an element at index or None if out of bounds.
Unlike Slice::get
, return value not borrow self
.
sourcepub fn range(&self, range: impl RangeBounds<usize>) -> Range<'a, T>
pub fn range(&self, range: impl RangeBounds<usize>) -> Range<'a, T>
Return a immutable sub-range of this Slice.
Unlike Slice::range
, return value not borrow self
.
sourcepub fn as_slices(&self) -> (&'a [T], &'a [T])
pub fn as_slices(&self) -> (&'a [T], &'a [T])
Returns a pair of slices. First slice is before gap. Second slice is after gap.
Unlike Slice::as_slices
, return value not borrow self
.
Methods from Deref<Target = Slice<T>>
sourcepub fn get(&self, index: usize) -> Option<&T>
pub fn get(&self, index: usize) -> Option<&T>
Returns a reference to an element at index or None if out of bounds.
sourcepub fn range(&self, range: impl RangeBounds<usize>) -> Range<'_, T>
pub fn range(&self, range: impl RangeBounds<usize>) -> Range<'_, T>
Trait Implementations
sourceimpl<'a, 'b, T> IntoIterator for &'a Range<'b, T>
impl<'a, 'b, T> IntoIterator for &'a Range<'b, T>
sourceimpl<'a, T: Ord> Ord for Range<'a, T>
impl<'a, T: Ord> Ord for Range<'a, T>
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl<'a, T, S> PartialEq<S> for Range<'a, T> where
T: PartialEq,
S: ?Sized,
for<'b> &'b S: IntoIterator<Item = &'b T>,
impl<'a, T, S> PartialEq<S> for Range<'a, T> where
T: PartialEq,
S: ?Sized,
for<'b> &'b S: IntoIterator<Item = &'b T>,
sourceimpl<'a, T, S> PartialOrd<S> for Range<'a, T> where
T: PartialOrd,
S: ?Sized,
for<'b> &'b S: IntoIterator<Item = &'b T>,
impl<'a, T, S> PartialOrd<S> for Range<'a, T> where
T: PartialOrd,
S: ?Sized,
for<'b> &'b S: IntoIterator<Item = &'b T>,
sourcefn partial_cmp(&self, other: &S) -> Option<Ordering>
fn partial_cmp(&self, other: &S) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn le(&self, other: &Rhs) -> bool
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
impl<'a, T: Eq> Eq for Range<'a, T>
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for Range<'a, T> where
T: RefUnwindSafe,
impl<'a, T> Send for Range<'a, T> where
T: Send + Sync,
impl<'a, T> Sync for Range<'a, T> where
T: Sync,
impl<'a, T> Unpin for Range<'a, T>
impl<'a, T> UnwindSafe for Range<'a, T> where
T: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more