pub enum Segment<'a> {
Number(Number<'a>),
Text(Text<'a>),
}
Expand description
A reference to a homogenous segment of text in a string.
Ord
and Eq
are implemented for this type, which delegate to their respective types for same variant comparison,
and otherwise considers every Segment::Number
to come before every Segment::Text
.
Variants§
Implementations§
Source§impl<'a> Segment<'a>
impl<'a> Segment<'a>
Sourcepub fn as_str(&self) -> &'a str
pub fn as_str(&self) -> &'a str
Returns the (non-empty) substring that was read via Segment::read
.
Trait Implementations§
Source§impl<'a> Ord for Segment<'a>
impl<'a> Ord for Segment<'a>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<'a> PartialOrd for Segment<'a>
impl<'a> PartialOrd for Segment<'a>
impl<'a> Copy for Segment<'a>
impl<'a> Eq for Segment<'a>
impl<'a> StructuralPartialEq for Segment<'a>
Auto Trait Implementations§
impl<'a> Freeze for Segment<'a>
impl<'a> RefUnwindSafe for Segment<'a>
impl<'a> Send for Segment<'a>
impl<'a> Sync for Segment<'a>
impl<'a> Unpin for Segment<'a>
impl<'a> UnwindSafe for Segment<'a>
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