pub struct SubRange { /* private fields */ }Expand description
A non-empty range targeting a smaller part of a spanned section of text.
Implementations§
Source§impl SubRange
impl SubRange
Sourcepub fn new(start: usize, end: usize) -> Option<Self>
pub fn new(start: usize, end: usize) -> Option<Self>
Create a new sub-range. The given start and end must create a non-empty range.
If start or end are above a 2^32-1, they will be saturated.
Sourcepub fn to_relative(self) -> Range<usize>
pub fn to_relative(self) -> Range<usize>
Convert to a normal range relative to the spanned range.
Sourcepub fn to_absolute(self, offset: usize) -> Range<usize>
pub fn to_absolute(self, offset: usize) -> Range<usize>
Convert to a normal range at an offset.
Trait Implementations§
impl Copy for SubRange
impl Eq for SubRange
impl StructuralPartialEq for SubRange
Auto Trait Implementations§
impl Freeze for SubRange
impl RefUnwindSafe for SubRange
impl Send for SubRange
impl Sync for SubRange
impl Unpin for SubRange
impl UnsafeUnpin for SubRange
impl UnwindSafe for SubRange
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more