Struct gluon_base::pos::ByteOffset
source · pub struct ByteOffset(pub i64);
Expand description
A byte offset in a source file
Tuple Fields§
§0: i64
Implementations§
source§impl ByteOffset
impl ByteOffset
sourcepub fn from_char_len(ch: char) -> ByteOffset
pub fn from_char_len(ch: char) -> ByteOffset
Create a byte offset from a UTF8-encoded character
use codespan::ByteOffset;
assert_eq!(ByteOffset::from_char_len('A').to_usize(), 1);
assert_eq!(ByteOffset::from_char_len('ß').to_usize(), 2);
assert_eq!(ByteOffset::from_char_len('ℝ').to_usize(), 3);
assert_eq!(ByteOffset::from_char_len('💣').to_usize(), 4);
sourcepub fn from_str_len(value: &str) -> ByteOffset
pub fn from_str_len(value: &str) -> ByteOffset
Create a byte offset from a UTF- encoded string
use codespan::ByteOffset;
assert_eq!(ByteOffset::from_str_len("A").to_usize(), 1);
assert_eq!(ByteOffset::from_str_len("ß").to_usize(), 2);
assert_eq!(ByteOffset::from_str_len("ℝ").to_usize(), 3);
assert_eq!(ByteOffset::from_str_len("💣").to_usize(), 4);
Trait Implementations§
source§impl Add<ByteOffset> for ByteIndex
impl Add<ByteOffset> for ByteIndex
source§impl Add<ByteOffset> for ByteOffset
impl Add<ByteOffset> for ByteOffset
§type Output = ByteOffset
type Output = ByteOffset
The resulting type after applying the
+
operator.source§fn add(self, rhs: ByteOffset) -> ByteOffset
fn add(self, rhs: ByteOffset) -> ByteOffset
Performs the
+
operation. Read moresource§impl AddAssign<ByteOffset> for ByteIndex
impl AddAssign<ByteOffset> for ByteIndex
source§fn add_assign(&mut self, rhs: ByteOffset)
fn add_assign(&mut self, rhs: ByteOffset)
Performs the
+=
operation. Read moresource§impl AddAssign<ByteOffset> for ByteOffset
impl AddAssign<ByteOffset> for ByteOffset
source§fn add_assign(&mut self, rhs: ByteOffset)
fn add_assign(&mut self, rhs: ByteOffset)
Performs the
+=
operation. Read moresource§impl Clone for ByteOffset
impl Clone for ByteOffset
source§fn clone(&self) -> ByteOffset
fn clone(&self) -> ByteOffset
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ByteOffset
impl Debug for ByteOffset
source§impl Default for ByteOffset
impl Default for ByteOffset
source§fn default() -> ByteOffset
fn default() -> ByteOffset
Returns the “default value” for a type. Read more
source§impl Display for ByteOffset
impl Display for ByteOffset
source§impl From<i64> for ByteOffset
impl From<i64> for ByteOffset
source§fn from(i: i64) -> ByteOffset
fn from(i: i64) -> ByteOffset
Converts to this type from the input type.
source§impl Hash for ByteOffset
impl Hash for ByteOffset
source§impl Neg for ByteOffset
impl Neg for ByteOffset
§type Output = ByteOffset
type Output = ByteOffset
The resulting type after applying the
-
operator.source§fn neg(self) -> ByteOffset
fn neg(self) -> ByteOffset
Performs the unary
-
operation. Read moresource§impl Offset for ByteOffset
impl Offset for ByteOffset
const ZERO: 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 · 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<ByteOffset> for ByteOffset
impl PartialEq<ByteOffset> for ByteOffset
source§fn eq(&self, other: &ByteOffset) -> bool
fn eq(&self, other: &ByteOffset) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<ByteOffset> for ByteOffset
impl PartialOrd<ByteOffset> for ByteOffset
source§fn partial_cmp(&self, other: &ByteOffset) -> Option<Ordering>
fn partial_cmp(&self, other: &ByteOffset) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Sub<ByteOffset> for ByteIndex
impl Sub<ByteOffset> for ByteIndex
source§impl Sub<ByteOffset> for ByteOffset
impl Sub<ByteOffset> for ByteOffset
§type Output = ByteOffset
type Output = ByteOffset
The resulting type after applying the
-
operator.source§fn sub(self, rhs: ByteOffset) -> ByteOffset
fn sub(self, rhs: ByteOffset) -> ByteOffset
Performs the
-
operation. Read moresource§impl SubAssign<ByteOffset> for ByteIndex
impl SubAssign<ByteOffset> for ByteIndex
source§fn sub_assign(&mut self, rhs: ByteOffset)
fn sub_assign(&mut self, rhs: ByteOffset)
Performs the
-=
operation. Read moresource§impl SubAssign<ByteOffset> for ByteOffset
impl SubAssign<ByteOffset> for ByteOffset
source§fn sub_assign(&mut self, rhs: ByteOffset)
fn sub_assign(&mut self, rhs: ByteOffset)
Performs the
-=
operation. Read moreimpl Copy for ByteOffset
impl Eq for ByteOffset
impl StructuralEq for ByteOffset
impl StructuralPartialEq for ByteOffset
Auto Trait Implementations§
impl RefUnwindSafe for ByteOffset
impl Send for ByteOffset
impl Sync for ByteOffset
impl Unpin 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