Struct dialectic_compiler::Spanned[][src]

pub struct Spanned<T> {
    pub inner: T,
    pub span: Span,
}

A thing attached to some Span that tracks its origin in the macro invocation.

Fields

inner: T

The thing to which the Span is attached.

span: Span

The Span which is attache to the thing.

Implementations

impl Spanned<Syntax>[src]

pub fn to_token_stream_with<F: ?Sized>(
    &self,
    add_optional: &mut F
) -> TokenStream where
    F: FnMut() -> bool
[src]

Convenience function for converting a Spanned<Syntax> into a TokenStream via Spanned::to_tokens_with.

pub fn to_tokens_with<F: ?Sized>(
    &self,
    add_optional: &mut F,
    tokens: &mut TokenStream
) where
    F: FnMut() -> bool
[src]

Convert a Spanned<Syntax> into tokens and append them to the provided token stream, with a predicate to determine whether or not optional syntax should be added or not.

The added optional syntax predicate is an FnMut closure so that we can randomly choose to add or not add optional trailing commas and similar during testing.

impl Spanned<Target>[src]

pub fn to_token_stream_with_crate_name(
    &self,
    dialectic_crate: &Path
) -> TokenStream
[src]

Convert this Spanned<Target> into a TokenStream using a provided crate name when referencing types from dialectic.

pub fn to_tokens_with_crate_name(
    &self,
    dialectic_crate: &Path,
    tokens: &mut TokenStream
)
[src]

Convert this Spanned<Target> into tokens and append them to the provided TokenStream using a provided crate name when referencing types from dialectic.

Trait Implementations

impl Arbitrary for Spanned<Syntax>[src]

Currently, we have a bit of a limitation on the arbitrary impl for syntax. The first part of this is that it’s annoying to generate valid labels for lifetimes, so for now we’re using a set of known valid lifetime names. The second is that generating valid Rust types is somewhat nontrivial and the syn crate does not have a way to ask it to implement Arbitrary for its Type AST node. So currently we just use the unit type () wherever we may need to place a type.

impl<T: Clone> Clone for Spanned<T>[src]

impl<T: Copy> Copy for Spanned<T>[src]

impl<T: Debug> Debug for Spanned<T>[src]

impl<T: Display> Display for Spanned<T>[src]

impl<T> From<T> for Spanned<T>[src]

impl Parse for Spanned<Syntax>[src]

impl ToTokens for Spanned<Syntax>[src]

impl ToTokens for Spanned<Target>[src]

Auto Trait Implementations

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<!> for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Spanned for T where
    T: Spanned + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.