pub(crate) struct Spanned<T> {
pub(crate) t: T,
pub(crate) span: Span,
}Expand description
A value with an associated span.
Fields§
§t: T§span: SpanImplementations§
Source§impl<T> Spanned<T>
impl<T> Spanned<T>
pub(super) fn new(t: T, span: Span) -> Spanned<T>
pub(super) fn from<U>(s: Spanned<U>) -> Spanned<T>where
T: From<U>,
Sourcepub(super) fn try_from<E, U>(
u: Spanned<U>,
) -> Result<Spanned<T>, FromRawReprError<Spanned<E>>>where
T: TryFrom<U, Error = FromRawReprError<E>>,
pub(super) fn try_from<E, U>(
u: Spanned<U>,
) -> Result<Spanned<T>, FromRawReprError<Spanned<E>>>where
T: TryFrom<U, Error = FromRawReprError<E>>,
Delegates to T: TryFrom, preserving span information in both the
success and error cases.
Trait Implementations§
Source§impl<Packed: With<NonZeroU32> + Copy> ToTokens for Spanned<AlignRepr<Packed>>
impl<Packed: With<NonZeroU32> + Copy> ToTokens for Spanned<AlignRepr<Packed>>
Source§fn to_tokens(&self, ts: &mut TokenStream)
fn to_tokens(&self, ts: &mut TokenStream)
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,
Source§impl<Prim: With<PrimitiveRepr> + Copy> ToTokens for Spanned<CompoundRepr<Prim>>
impl<Prim: With<PrimitiveRepr> + Copy> ToTokens for Spanned<CompoundRepr<Prim>>
Source§fn to_tokens(&self, ts: &mut TokenStream)
fn to_tokens(&self, ts: &mut TokenStream)
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,
Source§impl ToTokens for Spanned<PrimitiveRepr>
impl ToTokens for Spanned<PrimitiveRepr>
Source§fn to_tokens(&self, ts: &mut TokenStream)
fn to_tokens(&self, ts: &mut TokenStream)
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: Copy> Copy for Spanned<T>
Auto Trait Implementations§
impl<T> Freeze for Spanned<T>where
T: Freeze,
impl<T> RefUnwindSafe for Spanned<T>where
T: RefUnwindSafe,
impl<T> !Send for Spanned<T>
impl<T> !Sync for Spanned<T>
impl<T> Unpin for Spanned<T>where
T: Unpin,
impl<T> UnwindSafe for Spanned<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<T> Spanned for T
impl<T> Spanned for T
Source§fn span(&self) -> Span
fn span(&self) -> Span
Returns a
Span covering the complete contents of this syntax tree
node, or Span::call_site() if this node is empty.