Struct gluon_base::pos::ByteOffset
pub struct ByteOffset(pub i64);
Expand description
A byte offset in a source file
Tuple Fields§
§0: i64
Implementations§
§impl ByteOffset
impl ByteOffset
pub 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);
pub 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§
§impl Add<ByteOffset> for ByteIndex
impl Add<ByteOffset> for ByteIndex
§impl Add for ByteOffset
impl Add for ByteOffset
§type Output = ByteOffset
type Output = ByteOffset
The resulting type after applying the
+
operator.§fn add(self, rhs: ByteOffset) -> ByteOffset
fn add(self, rhs: ByteOffset) -> ByteOffset
Performs the
+
operation. Read more§impl AddAssign<ByteOffset> for ByteIndex
impl AddAssign<ByteOffset> for ByteIndex
§fn add_assign(&mut self, rhs: ByteOffset)
fn add_assign(&mut self, rhs: ByteOffset)
Performs the
+=
operation. Read more§impl AddAssign for ByteOffset
impl AddAssign for ByteOffset
§fn add_assign(&mut self, rhs: ByteOffset)
fn add_assign(&mut self, rhs: ByteOffset)
Performs the
+=
operation. Read more§impl Clone for ByteOffset
impl Clone for ByteOffset
§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 more§impl Debug for ByteOffset
impl Debug for ByteOffset
§impl Default for ByteOffset
impl Default for ByteOffset
§fn default() -> ByteOffset
fn default() -> ByteOffset
Returns the “default value” for a type. Read more
§impl<'de> Deserialize<'de> for ByteOffset
impl<'de> Deserialize<'de> for ByteOffset
§fn deserialize<__D>(
__deserializer: __D
) -> Result<ByteOffset, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<ByteOffset, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl Display for ByteOffset
impl Display for ByteOffset
§impl From<i64> for ByteOffset
impl From<i64> for ByteOffset
§fn from(i: i64) -> ByteOffset
fn from(i: i64) -> ByteOffset
Converts to this type from the input type.
§impl Hash for ByteOffset
impl Hash for ByteOffset
§impl Neg for ByteOffset
impl Neg for ByteOffset
§type Output = ByteOffset
type Output = ByteOffset
The resulting type after applying the
-
operator.§fn neg(self) -> ByteOffset
fn neg(self) -> ByteOffset
Performs the unary
-
operation. Read more§impl Offset for ByteOffset
impl Offset for ByteOffset
const ZERO: ByteOffset = _
§impl Ord for ByteOffset
impl Ord for ByteOffset
§impl PartialEq for ByteOffset
impl PartialEq for ByteOffset
§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 ==
.§impl PartialOrd for ByteOffset
impl PartialOrd for ByteOffset
§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 more§impl Serialize for ByteOffset
impl Serialize for ByteOffset
§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
§impl Sub<ByteOffset> for ByteIndex
impl Sub<ByteOffset> for ByteIndex
§impl Sub for ByteOffset
impl Sub for ByteOffset
§type Output = ByteOffset
type Output = ByteOffset
The resulting type after applying the
-
operator.§fn sub(self, rhs: ByteOffset) -> ByteOffset
fn sub(self, rhs: ByteOffset) -> ByteOffset
Performs the
-
operation. Read more§impl SubAssign<ByteOffset> for ByteIndex
impl SubAssign<ByteOffset> for ByteIndex
§fn sub_assign(&mut self, rhs: ByteOffset)
fn sub_assign(&mut self, rhs: ByteOffset)
Performs the
-=
operation. Read more§impl SubAssign for ByteOffset
impl SubAssign for ByteOffset
§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