Struct Punct
struct Punct(_)
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
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: &Self) -> charReturns the value of this punctuation character as
char.fn spacing(self: &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: &Self) -> SpanReturns the span for this punctuation character.
fn set_span(self: &mut Self, span: Span)Configure the span for this punctuation character.
impl Clone for Punct
fn clone(self: &Self) -> Punct
impl Debug for Punct
fn fmt(self: &Self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Display for Punct
fn fmt(self: &Self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Freeze for Punct
impl PartialEq for Punct
fn eq(self: &Self, rhs: &char) -> bool
impl RefUnwindSafe for Punct
impl Send for Punct
impl Sync for Punct
impl ToTokens for crate::Punct
fn to_tokens(self: &Self, tokens: &mut TokenStream)
impl Unpin for Punct
impl UnwindSafe for Punct
impl<T> Any for Punct
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Punct
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Punct
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Punct
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for Punct
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Punct
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> ToString for Punct
fn to_string(self: &Self) -> String
impl<T, U> Into for Punct
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Punct
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Punct
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>