Struct proc_macro::Punct
1.29.0 · source · [−]pub struct Punct(_);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
impl Punct
source
impl Punct
sourcepub fn new(ch: char, spacing: Spacing) -> Punct
source
pub fn new(ch: char, spacing: Spacing) -> Punct
sourceCreates 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.
pub fn spacing(&self) -> Spacing
source
pub fn spacing(&self) -> Spacing
sourceReturns the spacing of this punctuation character, indicating whether it’s immediately
followed by another Punct in the token stream, so they can potentially be combined into
a multi-character operator (Joint), or it’s followed by some other token or whitespace
(Alone) so the operator has certainly ended.
Trait Implementations
impl Display for Punct
source
impl Display for Punct
sourcePrints the punctuation character as a string that should be losslessly convertible back into the same character.
impl !Send for Punct
sourceimpl !Sync for Punct
sourceAuto Trait Implementations
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
source
impl<T> BorrowMut<T> for T where
T: ?Sized,
sourcefn borrow_mut(&mut self) -> &mut T
const: unstable · source
fn borrow_mut(&mut self) -> &mut T
const: unstable · sourceMutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
source
impl<T> ToOwned for T where
T: Clone,
sourcetype Owned = T
type Owned = T
The resulting type after obtaining ownership.
fn clone_into(&self, target: &mut T)
source
fn clone_into(&self, target: &mut T)
sourceUses borrowed data to replace owned data, usually by cloning. Read more