[][src]Struct macro_compose::Context

pub struct Context<'a, T> { /* fields omitted */ }

used to lint, expand and capture

a context might not have data in it (eg. if parsing the data failed), so calling the lint and expand functions does not guarantee the Lints and Expands actually run

Implementations

impl<'a, T> Context<'a, T>[src]

pub fn new(collector: &'a mut Collector, data: T) -> Self[src]

create a new context with the data

pub fn new_by_ref(collector: &'a mut Collector, data: &'a T) -> Self[src]

create a new context with the data passed by reference

pub fn new_empty(collector: &'a mut Collector) -> Self[src]

create a new context without any data in it

pub fn new_parse(collector: &'a mut Collector, data: TokenStream) -> Self where
    T: Parse
[src]

try to parse the data from a proc_macro::TokenStream

if parsing the data fails the error is reported to the collector

pub fn new_parse2(collector: &'a mut Collector, data: TokenStream) -> Self where
    T: Parse
[src]

try to parse the data from a proc_macro2::TokenStream

if parsing the data fails the error is reported to the collector

pub fn lint<L: Lint<T>>(&mut self, lint: &L) -> bool[src]

lint the macro input

returns true if the lint ran without reporting an error

pub fn expand(&mut self, expand: &impl Expand<T>)[src]

expand the macro and add the result to the collector

pub fn capture<E: Expand<T>>(&mut self, expand: &E) -> Option<E::Output>[src]

expand the macro and return the output

Auto Trait Implementations

impl<'a, T> !RefUnwindSafe for Context<'a, T>

impl<'a, T> !Send for Context<'a, T>

impl<'a, T> !Sync for Context<'a, T>

impl<'a, T> Unpin for Context<'a, T> where
    T: Unpin

impl<'a, T> !UnwindSafe for Context<'a, T>

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<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[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.