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() -> Self
pub const fn none() -> Self
Constructor for the TextPos that initializes it to ‘none’.
§Returns
A new TextPos instance that represents ‘no position’.
sourcepub fn end_of<T: AsBytes, X>(span: &LocatedSpan<T, X>) -> Self
pub fn end_of<T: AsBytes, X>(span: &LocatedSpan<T, X>) -> Self
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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<T: AsBytes, X> From<&LocatedSpan<T, X>> for TextPos
impl<T: AsBytes, X> From<&LocatedSpan<T, X>> for TextPos
source§fn from(value: &LocatedSpan<T, X>) -> Self
fn from(value: &LocatedSpan<T, X>) -> Self
Converts to this type from the input type.
source§impl<T: AsBytes, X> From<LocatedSpan<T, X>> for TextPos
impl<T: AsBytes, X> From<LocatedSpan<T, X>> for TextPos
source§fn from(value: LocatedSpan<T, X>) -> Self
fn from(value: LocatedSpan<T, X>) -> Self
Converts to this type from the input type.
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