pub struct BytePos(pub u32);Expand description
A byte offset. Keep this small (currently 32-bits), as AST contains a lot of them.
§Reserved
-
0 is reserved for dummy spans. It means
BytePos(0)means theBytePosis synthesized by the compiler. -
Values larger than
u32::MAX - 2^16are reserved for the comments.
u32::MAX is special value used to generate source map entries.
Tuple Fields§
§0: u32Implementations§
Source§impl BytePos
impl BytePos
Sourcepub const PLACEHOLDER: BytePos
pub const PLACEHOLDER: BytePos
Placeholders, commonly used where names are required, but the names are not referenced elsewhere.
Sourcepub const SYNTHESIZED: BytePos
pub const SYNTHESIZED: BytePos
Synthesized, but should be stored in a source map.
pub const fn is_reserved_for_comments(self) -> bool
Sourcepub const fn is_dummy(self) -> bool
pub const fn is_dummy(self) -> bool
Returns `true`` if this is synthesized and has no relevant input source code.
pub const fn is_pure(self) -> bool
pub const fn is_placeholder(self) -> bool
Sourcepub const fn can_have_comment(self) -> bool
pub const fn can_have_comment(self) -> bool
Returns `true`` if this is explicitly synthesized or has relevant input source so can have a comment.
Trait Implementations§
Source§impl Add<BytePos> for NonNarrowChar
impl Add<BytePos> for NonNarrowChar
Source§type Output = NonNarrowChar
type Output = NonNarrowChar
The resulting type after applying the
+ operator.Source§impl<'de> Deserialize<'de> for BytePos
impl<'de> Deserialize<'de> for BytePos
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<BytePos, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<BytePos, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl EqIgnoreSpan for BytePos
impl EqIgnoreSpan for BytePos
fn eq_ignore_span(&self, other: &BytePos) -> bool
Source§impl Ord for BytePos
impl Ord for BytePos
Source§impl PartialOrd for BytePos
impl PartialOrd for BytePos
Source§impl Serialize for BytePos
impl Serialize for BytePos
Source§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
Source§impl Sub<BytePos> for NonNarrowChar
impl Sub<BytePos> for NonNarrowChar
Source§type Output = NonNarrowChar
type Output = NonNarrowChar
The resulting type after applying the
- operator.impl Copy for BytePos
impl Eq for BytePos
impl StructuralPartialEq for BytePos
Auto Trait Implementations§
impl Freeze for BytePos
impl RefUnwindSafe for BytePos
impl Send for BytePos
impl Sync for BytePos
impl Unpin for BytePos
impl UnsafeUnpin for BytePos
impl UnwindSafe for BytePos
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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§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.Source§impl<T> ImplicitClone for Twhere
T: Clone,
impl<T> ImplicitClone for Twhere
T: Clone,
fn clone_quote_var(&self) -> Self
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> SpanExt for Twhere
T: Spanned,
impl<T> SpanExt for Twhere
T: Spanned,
fn is_synthesized(&self) -> bool
fn starts_on_new_line(&self, format: ListFormat) -> bool
Source§fn comment_range(&self) -> Span
fn comment_range(&self) -> Span
Gets a custom text range to use when emitting comments.