pub struct TokenStream(pub String);
Expand description
A stream of tokens
Tuple Fields§
§0: String
Implementations§
Source§impl TokenStream
impl TokenStream
pub fn new() -> Self
Sourcepub fn combine(&mut self, other: &TokenStream)
pub fn combine(&mut self, other: &TokenStream)
Appends another stream to the stream
note: a space will be inserted before the other stream
pub fn join(&self, value: &str) -> Self
pub fn is_empty(&self) -> bool
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Convert the stream into a String
Sourcepub fn parse<T: FromStr>(self) -> Result<T, T::Err>
pub fn parse<T: FromStr>(self) -> Result<T, T::Err>
Parse the token stream as something
Mostly used with proc_macro2::TokenStream
or proc_macro::TokenStream
pub fn push(&mut self, c: char)
pub fn push_str(&mut self, str: &str)
Trait Implementations§
Source§impl Clone for TokenStream
impl Clone for TokenStream
Source§fn clone(&self) -> TokenStream
fn clone(&self) -> TokenStream
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for TokenStream
impl Debug for TokenStream
Source§impl Default for TokenStream
impl Default for TokenStream
Source§impl Display for TokenStream
impl Display for TokenStream
Source§impl From<&String> for TokenStream
impl From<&String> for TokenStream
Source§impl From<&str> for TokenStream
impl From<&str> for TokenStream
Source§impl From<String> for TokenStream
impl From<String> for TokenStream
Source§impl FromIterator<TokenStream> for TokenStream
impl FromIterator<TokenStream> for TokenStream
Source§fn from_iter<I: IntoIterator<Item = TokenStream>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = TokenStream>>(iter: I) -> Self
Creates a value from an iterator. Read more
Source§impl Ord for TokenStream
impl Ord for TokenStream
Source§fn cmp(&self, other: &TokenStream) -> Ordering
fn cmp(&self, other: &TokenStream) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for TokenStream
impl PartialEq for TokenStream
Source§impl PartialOrd for TokenStream
impl PartialOrd for TokenStream
Source§impl ToTokens for TokenStream
impl ToTokens for TokenStream
Source§fn to_tokens(&self, dst: &mut TokenStream)
fn to_tokens(&self, dst: &mut TokenStream)
Write
self
to the given 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
impl Eq for TokenStream
impl StructuralPartialEq for TokenStream
Auto Trait Implementations§
impl Freeze for TokenStream
impl RefUnwindSafe for TokenStream
impl Send for TokenStream
impl Sync for TokenStream
impl Unpin for TokenStream
impl UnwindSafe for TokenStream
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