Struct Punct
pub struct Punct(pub(crate) Punct<Span>);
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.
Fields
0: Punct<Span>
Implementations
impl Punct
fn new(ch: char, spacing: Spacing) -> PunctCreates a new
Punctfrom the given character and spacing. Thechargument must be a valid punctuation character permitted by the language, otherwise the function will panic.The returned
Punctwill have the default span ofSpan::call_site()which can be further configured with theset_spanmethod below.fn as_char(&self) -> charReturns the value of this punctuation character as
char.fn spacing(&self) -> SpacingReturns the spacing of this punctuation character, indicating whether it can be potentially combined into a multi-character operator with the following token (
Joint), or whether the operator has definitely ended (Alone).fn span(&self) -> SpanReturns the span for this punctuation character.
fn set_span(&mut self, span: Span)Configure the span for this punctuation character.
Trait Implementations
impl !Send for Punct
impl !Sync for Punct
impl Clone for Punct
fn clone(&self) -> Self
impl Debug for Punct
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Display for Punct
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl PartialEq<char> for Punct
fn eq(&self, rhs: &char) -> bool
impl ToTokens for Punct
fn to_tokens(&self, tokens: &mut TokenStream)
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
impl<T> Any for Punct
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Punct
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Punct
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Punct
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Punct
fn from(t: T) -> TReturns the argument unchanged.
impl<T> RepToTokensExt for Punct
where
T: ToTokens + ?Sized,
impl<T> SizeHint for Punct
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for Punct
impl<T> ToOwned for Punct
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T> ToString for Punct
where
T: Display + ?Sized,
fn to_string(&self) -> String
impl<T, U> Into<U> for Punct
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Punct
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Punct
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>