pub struct TextPos {
pub line: usize,
pub col: usize,
}
Expand description
Defines a position in the input text.
Fields§
§line: usize
The y-coordinate of the position (one-indexed)
col: usize
The x-coordinate of the position (one-indexed)
Implementations§
source§impl TextPos
impl TextPos
sourcepub const fn none() -> TextPos
pub const fn none() -> TextPos
Constructor for the TextPos that initializes it to ‘none’.
§Returns
A new TextPos instance that represents ‘no position’.
sourcepub fn end_of<T, X>(span: &LocatedSpan<T, X>) -> TextPoswhere
T: AsBytes,
pub fn end_of<T, X>(span: &LocatedSpan<T, X>) -> TextPoswhere
T: AsBytes,
Constructor for the TextPos that initializes it to the end of the given Span.
Concretely, it adds the length of the span to the Span’s start location, modulo any newlines (‘\n’) it finds.
§Generic types
T
: The type stored in the LocatedSpan.X
: Any extra information stored in the span.
§Arguments
span
: The LocatedSpan that contains both the text and position that we will use to compute the end position.
§Returns
A new TextPos instance that points to the end of the span (inclusive).
Trait Implementations§
source§impl<'de> Deserialize<'de> for TextPos
impl<'de> Deserialize<'de> for TextPos
source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TextPos, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TextPos, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<T, X> From<&LocatedSpan<T, X>> for TextPoswhere
T: AsBytes,
impl<T, X> From<&LocatedSpan<T, X>> for TextPoswhere
T: AsBytes,
source§fn from(value: &LocatedSpan<T, X>) -> TextPos
fn from(value: &LocatedSpan<T, X>) -> TextPos
Converts to this type from the input type.
source§impl<T, X> From<LocatedSpan<T, X>> for TextPoswhere
T: AsBytes,
impl<T, X> From<LocatedSpan<T, X>> for TextPoswhere
T: AsBytes,
source§fn from(value: LocatedSpan<T, X>) -> TextPos
fn from(value: LocatedSpan<T, X>) -> TextPos
Converts to this type from the input type.
source§impl Serialize for TextPos
impl Serialize for TextPos
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
Auto Trait Implementations§
impl Freeze for TextPos
impl RefUnwindSafe for TextPos
impl Send for TextPos
impl Sync for TextPos
impl Unpin for TextPos
impl UnwindSafe for TextPos
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request