[−][src]Struct range::Range
A representation of a range
The type parameter is used to wrap data related to the range.
Fields
offset: usize
The range offset
length: usize
The range length
data: T
The data described within the range.
Methods
impl Range
[src]
pub fn new(offset: usize, length: usize) -> Range
[src]
Creates a new Range
pub fn wrap<T>(self, data: T) -> Range<T>
[src]
Wraps some data in the range.
pub fn empty(offset: usize) -> Range
[src]
Creates an empty range with an offset.
pub fn shrink_n(&self, n: usize) -> Option<Range>
[src]
Shrinks range at both ends with n
items.
pub fn shrink(&self) -> Option<Range>
[src]
Shrinks range at both ends with 1 item.
pub fn intersect(&self, other: &Range) -> Option<Range>
[src]
Intersects a range with another, where ends are excluded.
pub fn ends_intersect(&self, other: &Range) -> Option<Range>
[src]
Intersects a range with another, where ends are included.
impl<T> Range<T>
[src]
pub fn is_empty(&self) -> bool
[src]
Returns true if range is empty
pub fn next_offset(&self) -> usize
[src]
Returns the next offset
pub fn iter(&self) -> Range<usize>
[src]
Returns a range iterator.
pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Range<U>
[src]
Maps from some data to another.
pub fn range(&self) -> Range
[src]
Returns range information without the data.
pub fn unwrap(self) -> T
[src]
Unwraps the data.
pub fn decouple(self) -> (Range, T)
[src]
Decouples range and data.
Trait Implementations
impl<T: Copy> Copy for Range<T>
[src]
impl<T: Eq> Eq for Range<T>
[src]
impl<T: Clone> Clone for Range<T>
[src]
fn clone(&self) -> Range<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: PartialEq> PartialEq<Range<T>> for Range<T>
[src]
impl<T> From<(Range<()>, T)> for Range<T>
[src]
impl<T: Debug> Debug for Range<T>
[src]
impl<T: Hash> Hash for Range<T>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,