Struct piston_meta::Range [−][src]
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.
Implementations
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>(self, f: F) -> Range<U> where
F: FnOnce(T) -> U,
[src]
F: FnOnce(T) -> U,
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> Clone for Range<T> where
T: Clone,
[src]
T: Clone,
impl<T> Copy for Range<T> where
T: Copy,
[src]
T: Copy,
impl<T> Debug for Range<T> where
T: Debug,
[src]
T: Debug,
impl<T> Eq for Range<T> where
T: Eq,
[src]
T: Eq,
impl<T> From<(Range<()>, T)> for Range<T>
[src]
impl<T> Hash for Range<T> where
T: Hash,
[src]
T: Hash,
pub fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T> PartialEq<Range<T>> for Range<T> where
T: PartialEq<T>,
[src]
T: PartialEq<T>,
impl<T> StructuralEq for Range<T>
[src]
impl<T> StructuralPartialEq for Range<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Range<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Range<T> where
T: Send,
T: Send,
impl<T> Sync for Range<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Range<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Range<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,