Struct pmutil::spanned_quote::Quote
source · pub struct Quote { /* private fields */ }
Expand description
Buffer for quasi quotting.
Implementations§
source§impl Quote
impl Quote
pub fn new<S: Respan + 'static>(span: S) -> Self
sourcepub fn new_call_site() -> Self
pub fn new_call_site() -> Self
Shorthand for
ⓘ
Quote::new(Span::call_site())
sourcepub fn from_tokens(tokens: &dyn ToTokens) -> Self
pub fn from_tokens(tokens: &dyn ToTokens) -> Self
Shorthand for
ⓘ
Quote::new(tokens.first_last())
source§impl Quote
impl Quote
Methods for quasi-quotting.
pub fn quote_with<F>(self, quote: F) -> Selfwhere F: FnOnce(&mut Self),
sourcepub fn push_parsed(&mut self, token: &str)
pub fn push_parsed(&mut self, token: &str)
Parse token
and append it to self
.
sourcepub fn push_group<F>(&mut self, delim: Delimiter, child: F)where
F: FnOnce(&mut Quote),
pub fn push_group<F>(&mut self, delim: Delimiter, child: F)where F: FnOnce(&mut Quote),
Respan and append TokenStream::Group
sourcepub fn push_tokens<T: ?Sized + ToTokens>(&mut self, node: &T)
pub fn push_tokens<T: ?Sized + ToTokens>(&mut self, node: &T)
Appends node into self
without respanning.
Trait Implementations§
source§impl From<Quote> for TokenStream
impl From<Quote> for TokenStream
source§impl From<Quote> for TokenStream
impl From<Quote> for TokenStream
source§impl IntoIterator for Quote
impl IntoIterator for Quote
§type IntoIter = <TokenStream as IntoIterator>::IntoIter
type IntoIter = <TokenStream as IntoIterator>::IntoIter
Which kind of iterator are we turning this into?
§type Item = <TokenStream as IntoIterator>::Item
type Item = <TokenStream as IntoIterator>::Item
The type of the elements being iterated over.
source§impl ToTokens for Quote
impl ToTokens for Quote
source§fn to_tokens(&self, dst: &mut TokenStream)
fn to_tokens(&self, dst: &mut TokenStream)
source§fn into_token_stream(self) -> TokenStream
fn into_token_stream(self) -> TokenStream
source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Auto Trait Implementations§
impl !RefUnwindSafe for Quote
impl !Send for Quote
impl !Sync for Quote
impl Unpin for Quote
impl !UnwindSafe for Quote
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> ToTokensExt for Twhere
T: ToTokens,
impl<T> ToTokensExt for Twhere T: ToTokens,
fn dump(&self) -> TokenStream
source§fn first_last(&self) -> FirstLast
fn first_last(&self) -> FirstLast
Usage:
Quote::new(body.first_last())