pub struct Punct(pub(crate) Punct<Span>);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.
Tuple Fields§
§0: Punct<Span>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§
impl !Send for Punct
impl !Sync for Punct
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: IntoIterator<Item = Punct>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Punct>>(&mut self, iter: T)
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 #72631)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 #72631)Reserves capacity in a collection for the given number of additional elements. Read more
Source§#[doc(hidden)]unsafe fn extend_one_unchecked(&mut self, item: A)where
Self: Sized,
#[doc(hidden)]unsafe fn extend_one_unchecked(&mut self, item: A)where
Self: Sized,
🔬This is a nightly-only experimental API. (
extend_one_unchecked)Extends a collection with one element, without checking there is enough capacity for it. 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 #130977)Source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
🔬This is a nightly-only experimental API. (
proc_macro_totokens #130977)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 #130977)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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> RepToTokensExt for T
impl<T> RepToTokensExt for T
Source§fn next(&self) -> Option<&Self>
fn next(&self) -> Option<&Self>
🔬This is a nightly-only experimental API. (
proc_macro_internals)Pretend to be an iterator for the purposes of
quote_into_iter.
This allows repeated calls to quote_into_iter to continue
correctly returning DoesNotHaveIter.Source§fn quote_into_iter(&self) -> (&Self, DoesNotHaveIter)
fn quote_into_iter(&self) -> (&Self, DoesNotHaveIter)
🔬This is a nightly-only experimental API. (
proc_macro_internals)Source§impl<T> SizeHint for Twhere
T: ?Sized,
impl<T> SizeHint for Twhere
T: ?Sized,
Source§default fn lower_bound(&self) -> usize
default fn lower_bound(&self) -> usize
🔬This is a nightly-only experimental API. (
core_io_internals)Returns a lower bound on the number of elements this container-like item
contains.
For example, an array
[u8; 12] could return any value between 0 and
12 inclusively as a correct implementation. Read moreSource§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)]const SIZE: usize = _
#[doc(hidden)]const SIZE: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const ALIGN: usize = _
#[doc(hidden)]const ALIGN: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const ALIGNMENT: Alignment = _
#[doc(hidden)]const ALIGNMENT: Alignment = _
🔬This is a nightly-only experimental API. (
ptr_alignment_type #102070)Source§#[doc(hidden)]const IS_ZST: bool = _
#[doc(hidden)]const IS_ZST: bool = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const LAYOUT: Layout = _
#[doc(hidden)]const LAYOUT: Layout = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const MAX_SLICE_LEN: usize = _
#[doc(hidden)]const MAX_SLICE_LEN: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties)The largest safe length for a
[Self]. Read more