pub struct SpannableNode<T: Parse> { /* private fields */ }
Expand description
A node is anything that implements Parse
. SpannableNode
then, is a wrapper around this node that holds span information about it.
It is intended to be a mostly see-through wrapper around whatever the inner node is. Parse
is implemented on it in a way that
automatically calculates the span information.
Implementations§
Source§impl<T: Parse> SpannableNode<T>
impl<T: Parse> SpannableNode<T>
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Get the inner node, consuming the wrapper.
Sourcepub fn to_inner_mut(&mut self) -> &mut T
pub fn to_inner_mut(&mut self) -> &mut T
Get a mutable reference to the inner node.
Sourcepub fn deconstruct(&mut self) -> (&mut T, &mut Span)
pub fn deconstruct(&mut self) -> (&mut T, &mut Span)
Get mutable references to both the inner node and the span.
Trait Implementations§
Source§impl<T: Clone + Parse> Clone for SpannableNode<T>
impl<T: Clone + Parse> Clone for SpannableNode<T>
Source§fn clone(&self) -> SpannableNode<T>
fn clone(&self) -> SpannableNode<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<T: Parse> From<T> for SpannableNode<T>
impl<T: Parse> From<T> for SpannableNode<T>
Source§impl<T: Parse + Debug> Parse for SpannableNode<T>
impl<T: Parse + Debug> Parse for SpannableNode<T>
Source§fn parse(lexer: &mut LexerBridge<'_>) -> ParseResult<Self>where
Self: Sized,
fn parse(lexer: &mut LexerBridge<'_>) -> ParseResult<Self>where
Self: Sized,
Given a lexer, try to parse a valid instance of this node. Read more
Source§fn parse_sep(
lexer: &mut LexerBridge<'_>,
join: Tokens,
) -> ParseResult<Vec<Self>>where
Self: Sized,
fn parse_sep(
lexer: &mut LexerBridge<'_>,
join: Tokens,
) -> ParseResult<Vec<Self>>where
Self: Sized,
Source§fn parse_sep_end(
lexer: &mut LexerBridge<'_>,
join: Tokens,
end: Tokens,
) -> ParseResult<Vec<Self>>where
Self: Sized,
fn parse_sep_end(
lexer: &mut LexerBridge<'_>,
join: Tokens,
end: Tokens,
) -> ParseResult<Vec<Self>>where
Self: Sized,
Source§impl<T: Parse> Spannable for SpannableNode<T>
impl<T: Parse> Spannable for SpannableNode<T>
Source§impl<T: Parse + ToTokens> ToTokens for SpannableNode<T>
impl<T: Parse + ToTokens> ToTokens for SpannableNode<T>
Source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
impl<T: Parse + Eq> Eq for SpannableNode<T>
Auto Trait Implementations§
impl<T> Freeze for SpannableNode<T>where
T: Freeze,
impl<T> RefUnwindSafe for SpannableNode<T>where
T: RefUnwindSafe,
impl<T> Send for SpannableNode<T>where
T: Send,
impl<T> Sync for SpannableNode<T>where
T: Sync,
impl<T> Unpin for SpannableNode<T>where
T: Unpin,
impl<T> UnwindSafe for SpannableNode<T>where
T: UnwindSafe,
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> 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> 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> WrapSpannable<T, SpannableNode<T>> for Twhere
T: Parse,
impl<T> WrapSpannable<T, SpannableNode<T>> for Twhere
T: Parse,
Source§fn wrap_spannable(self) -> SpannableNode<T>
fn wrap_spannable(self) -> SpannableNode<T>
Wrap dummy span information around the node.
Source§fn into_spanned(self, span: Range<usize>) -> SpannableNode<T>
fn into_spanned(self, span: Range<usize>) -> SpannableNode<T>
Convert the node into a
SpannableNode
with the specified Span
.