Type Alias arithmetic_parser::SpannedExpr
source · pub type SpannedExpr<'a, T> = Spanned<'a, Expr<'a, T>>;
Expand description
Expr
with the associated type and code span.
Aliased Type§
struct SpannedExpr<'a, T> {
pub extra: Expr<'a, T>,
/* private fields */
}
Fields§
§extra: Expr<'a, T>
Extra information that can be embedded by the user.
Implementations§
source§impl<Span, T> LocatedSpan<Span, T>
impl<Span, T> LocatedSpan<Span, T>
sourcepub fn location_offset(&self) -> usize
pub fn location_offset(&self) -> usize
The offset represents the position of the fragment relatively to the input of the parser. It starts at offset 0.
sourcepub fn location_line(&self) -> u32
pub fn location_line(&self) -> u32
The line number of the fragment relatively to the input of the parser. It starts at line 1.
sourcepub fn get_column(&self) -> usize
pub fn get_column(&self) -> usize
The column of the fragment start.
sourcepub fn fragment(&self) -> &Span
pub fn fragment(&self) -> &Span
The fragment that is spanned. The fragment represents a part of the input of the parser.
sourcepub fn map_extra<U>(self, map_fn: impl FnOnce(T) -> U) -> LocatedSpan<Span, U>
pub fn map_extra<U>(self, map_fn: impl FnOnce(T) -> U) -> LocatedSpan<Span, U>
Maps the extra
field of this span using the provided closure.
sourcepub fn map_fragment<U>(
self,
map_fn: impl FnOnce(Span) -> U
) -> LocatedSpan<U, T>
pub fn map_fragment<U>( self, map_fn: impl FnOnce(Span) -> U ) -> LocatedSpan<U, T>
Maps the fragment field of this span using the provided closure.
source§impl<Span: Copy, T> LocatedSpan<Span, T>
impl<Span: Copy, T> LocatedSpan<Span, T>
sourcepub fn as_ref(&self) -> LocatedSpan<Span, &T>
pub fn as_ref(&self) -> LocatedSpan<Span, &T>
Returns a copy of this span with borrowed extra
field.
sourcepub fn copy_with_extra<U>(&self, value: U) -> LocatedSpan<Span, U>
pub fn copy_with_extra<U>(&self, value: U) -> LocatedSpan<Span, U>
Copies this span with the provided extra
field.
sourcepub fn with_no_extra(&self) -> LocatedSpan<Span>
pub fn with_no_extra(&self) -> LocatedSpan<Span>
Removes extra
field from this span.
Trait Implementations§
source§impl<Span: Clone, T: Clone> Clone for LocatedSpan<Span, T>
impl<Span: Clone, T: Clone> Clone for LocatedSpan<Span, T>
source§fn clone(&self) -> LocatedSpan<Span, T>
fn clone(&self) -> LocatedSpan<Span, T>
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<'a, T> From<LocatedSpan<&'a str, T>> for LocatedSpan<&'a str, T>
impl<'a, T> From<LocatedSpan<&'a str, T>> for LocatedSpan<&'a str, T>
source§fn from(value: LocatedSpan<&'a str, T>) -> Self
fn from(value: LocatedSpan<&'a str, T>) -> Self
Converts to this type from the input type.