Struct mm0_util::Span [−][src]
Points to a specific region of a source file by identifying the region’s start and end points.
Fields
start: usize
The byte index of the beginning of the span (inclusive).
end: usize
The byte index of the end of the span (exclusive).
Methods from Deref<Target = Range<usize>>
pub fn contains<U>(&self, item: &U) -> bool where
Idx: PartialOrd<U>,
U: PartialOrd<Idx> + ?Sized,
1.35.0[src]
Idx: PartialOrd<U>,
U: PartialOrd<Idx> + ?Sized,
Returns true
if item
is contained in the range.
Examples
assert!(!(3..5).contains(&2)); assert!( (3..5).contains(&3)); assert!( (3..5).contains(&4)); assert!(!(3..5).contains(&5)); assert!(!(3..3).contains(&3)); assert!(!(3..2).contains(&3)); assert!( (0.0..1.0).contains(&0.5)); assert!(!(0.0..1.0).contains(&f32::NAN)); assert!(!(0.0..f32::NAN).contains(&0.5)); assert!(!(f32::NAN..1.0).contains(&0.5));
pub fn is_empty(&self) -> bool
1.47.0[src]
Returns true
if the range contains no items.
Examples
assert!(!(3..5).is_empty()); assert!( (3..3).is_empty()); assert!( (3..2).is_empty());
The range is empty if either side is incomparable:
assert!(!(3.0..5.0).is_empty()); assert!( (3.0..f32::NAN).is_empty()); assert!( (f32::NAN..5.0).is_empty());
Trait Implementations
impl Clone for Span
[src]
impl Copy for Span
[src]
impl Debug for Span
[src]
impl DeepSizeOf for Span
[src]
fn deep_size_of_children(&self, _: &mut Context) -> usize
[src]
pub fn deep_size_of(&self) -> usize
[src]
pub fn deep_size_of_with(&self, context: &mut Context) -> usize
[src]
impl Deref for Span
[src]
type Target = Range<usize>
The resulting type after dereferencing.
fn deref(&self) -> &Range<usize>ⓘ
[src]
impl DerefMut for Span
[src]
impl Eq for Span
[src]
impl<'a> From<&'a FileSpan> for Span
[src]
impl From<Range<usize>> for Span
[src]
impl From<RangeInclusive<usize>> for Span
[src]
fn from(r: RangeInclusive<usize>) -> Self
[src]
impl From<Span> for Range<usize>
[src]
impl From<usize> for Span
[src]
impl Hash for Span
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Index<Span> for LinedString
[src]
Allows LinedString
to be indexed with a Span
, since Span
is essentially a range.
impl IntoIterator for Span
[src]
type Item = usize
The type of the elements being iterated over.
type IntoIter = Range<usize>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Range<usize>ⓘ
[src]
impl PartialEq<Span> for Span
[src]
impl StructuralEq for Span
[src]
impl StructuralPartialEq for Span
[src]
Auto Trait Implementations
impl RefUnwindSafe for Span
impl Send for Span
impl Sync for Span
impl Unpin for Span
impl UnwindSafe for Span
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> Erased for T
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>,