pub struct ByteOffset(/* private fields */);Expand description
0-based UTF-8 byte offset into source text.
Prefer TextSize for text_size::TextRange construction; this
newtype marks raw parser byte offsets at crate boundaries.
Implementations§
Trait Implementations§
Source§impl Clone for ByteOffset
impl Clone for ByteOffset
Source§fn clone(&self) -> ByteOffset
fn clone(&self) -> ByteOffset
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ByteOffset
Source§impl Debug for ByteOffset
impl Debug for ByteOffset
Source§impl Display for ByteOffset
impl Display for ByteOffset
impl Eq for ByteOffset
Source§impl From<ByteOffset> for usize
impl From<ByteOffset> for usize
Source§fn from(value: ByteOffset) -> Self
fn from(value: ByteOffset) -> Self
Converts to this type from the input type.
Source§impl From<TextSize> for ByteOffset
impl From<TextSize> for ByteOffset
Source§impl From<usize> for ByteOffset
impl From<usize> for ByteOffset
Source§impl Hash for ByteOffset
impl Hash for ByteOffset
Source§impl Ord for ByteOffset
impl Ord for ByteOffset
Source§fn cmp(&self, other: &ByteOffset) -> Ordering
fn cmp(&self, other: &ByteOffset) -> Ordering
1.21.0 (const: unstable) · 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 PartialEq for ByteOffset
impl PartialEq for ByteOffset
Source§fn eq(&self, other: &ByteOffset) -> bool
fn eq(&self, other: &ByteOffset) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for ByteOffset
impl PartialOrd for ByteOffset
impl StructuralPartialEq for ByteOffset
Source§impl TryFrom<ByteOffset> for TextSize
impl TryFrom<ByteOffset> for TextSize
Source§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl Freeze for ByteOffset
impl RefUnwindSafe for ByteOffset
impl Send for ByteOffset
impl Sync for ByteOffset
impl Unpin for ByteOffset
impl UnsafeUnpin for ByteOffset
impl UnwindSafe for ByteOffset
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