pub struct Punct(/* private fields */);Expand description
A Punct is a single punctuation character such as +, - or #.
Multi-character operators like += are represented as two instances of Punct with different
forms of Spacing returned.
Implementations§
Source§impl Punct
impl Punct
1.29.0 · Sourcepub fn new(ch: char, spacing: Spacing) -> Punct
pub fn new(ch: char, spacing: Spacing) -> Punct
Creates a new Punct from the given character and spacing.
The ch argument must be a valid punctuation character permitted by the language,
otherwise the function will panic.
The returned Punct will have the default span of Span::call_site()
which can be further configured with the set_span method below.
1.29.0 · Sourcepub fn as_char(&self) -> char
pub fn as_char(&self) -> char
Returns the value of this punctuation character as char.
Trait Implementations§
1.29.0 · Source§impl Display for Punct
Prints the punctuation character as a string that should be losslessly convertible
back into the same character.
impl Display for Punct
Prints the punctuation character as a string that should be losslessly convertible back into the same character.
1.92.0 · Source§impl Extend<Punct> for TokenStream
impl Extend<Punct> for TokenStream
Source§fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = Punct>,
fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = Punct>,
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl ToTokens for Punct
impl ToTokens for Punct
Source§fn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
🔬This is a nightly-only experimental API. (
proc_macro_totokens)Source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
🔬This is a nightly-only experimental API. (
proc_macro_totokens)Source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
🔬This is a nightly-only experimental API. (
proc_macro_totokens)impl !Send for Punct
impl !Sync for Punct
Auto Trait Implementations§
impl Freeze for Punct
impl RefUnwindSafe for Punct
impl Unpin for Punct
impl UnsafeUnpin for Punct
impl UnwindSafe for Punct
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