pub struct Context<'a, T> { /* private fields */ }
Expand description
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 Lint
s and Expand
s actually run
Implementations§
Source§impl<'a, T> Context<'a, T>
impl<'a, T> Context<'a, T>
Sourcepub fn new_by_ref(collector: &'a mut Collector, data: &'a T) -> Self
pub fn new_by_ref(collector: &'a mut Collector, data: &'a T) -> Self
create a new context with the data passed by reference
Sourcepub fn new_empty(collector: &'a mut Collector) -> Self
pub fn new_empty(collector: &'a mut Collector) -> Self
create a new context without any data in it
Sourcepub fn new_parse(collector: &'a mut Collector, data: TokenStream) -> Selfwhere
T: Parse,
pub fn new_parse(collector: &'a mut Collector, data: TokenStream) -> Selfwhere
T: Parse,
try to parse the data from a proc_macro::TokenStream
if parsing the data fails the error is reported to the collector
Sourcepub fn new_parse2(collector: &'a mut Collector, data: TokenStream) -> Selfwhere
T: Parse,
pub fn new_parse2(collector: &'a mut Collector, data: TokenStream) -> Selfwhere
T: Parse,
try to parse the data from a proc_macro2::TokenStream
if parsing the data fails the error is reported to the collector
Sourcepub fn lint<L: Lint<T>>(&mut self, lint: &L) -> bool
pub fn lint<L: Lint<T>>(&mut self, lint: &L) -> bool
lint the macro input
returns true if the lint ran without reporting an error
Auto Trait Implementations§
impl<'a, T> Freeze for Context<'a, T>where
T: Freeze,
impl<'a, T> RefUnwindSafe for Context<'a, T>where
T: RefUnwindSafe,
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§
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