pub struct Span { /* private fields */ }Expand description
A span, designating a range of bytes where a token is located.
Uses u32::MAX as a sentinel value to represent unknown spans (e.g.,
decoded from binary).
Implementations§
Source§impl Span
impl Span
pub fn new(start: u32, end: u32) -> Span
Sourcepub fn adjust(&mut self, offset: u32)
pub fn adjust(&mut self, offset: u32)
Adjusts this span by adding the given byte offset to both start and end.
Sourcepub fn set_end(&mut self, new_end: u32)
pub fn set_end(&mut self, new_end: u32)
Sets the end offset. If this is unknown, converts to a zero-width span at that position.
Trait Implementations§
impl Copy for Span
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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.