pub struct Span {
pub start: u32,
pub end: u32,
}Expand description
A half-open byte range [start, end) into some source string.
Fields§
§start: u32§end: u32Implementations§
Source§impl Span
impl Span
pub const fn new(start: u32, end: u32) -> Self
pub const fn point(offset: u32) -> Self
pub fn len(self) -> u32
pub fn is_empty(self) -> bool
Sourcepub fn union(self, other: Span) -> Span
pub fn union(self, other: Span) -> Span
The smallest span covering both. Useful for building a list node’s span from its children.
pub fn slice<'a>(self, src: &'a str) -> &'a str
pub fn contains(self, offset: u32) -> bool
Trait Implementations§
impl Copy for Span
Source§impl<'de> Deserialize<'de> for Span
impl<'de> Deserialize<'de> for Span
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Span
impl StructuralPartialEq for Span
Auto Trait Implementations§
impl Freeze for Span
impl RefUnwindSafe for Span
impl Send for Span
impl Sync for Span
impl Unpin for Span
impl UnsafeUnpin for Span
impl UnwindSafe for Span
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