Enum Delimiter

enum Delimiter

Describes how a sequence of token trees is delimited.

Variants

Parenthesis

( ... )

Brace

{ ... }

Bracket

[ ... ]

None

∅ ... ∅

An invisible delimiter, that may, for example, appear around tokens coming from a "macro variable" $var. It is important to preserve operator priorities in cases like $var * 3 where $var is 1 + 2. Invisible delimiters may not survive roundtrip of a token stream through a string.

Note: rustc currently can ignore the grouping of tokens delimited by None in the output of a proc_macro. Only None-delimited groups created by a macro_rules macro in the input of a proc_macro macro are preserved, and only in very specific circumstances. Any None-delimited groups (re)created by a proc_macro will therefore not preserve operator priorities as indicated above. The other Delimiter variants should be used instead in this context. This is a rustc bug. For details, see rust-lang/rust#67062.

Implementations

impl Clone for Delimiter

fn clone(self: &Self) -> Delimiter

impl Copy for Delimiter

impl Debug for Delimiter

fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result

impl Eq for Delimiter

impl Freeze for Delimiter

impl PartialEq for Delimiter

fn eq(self: &Self, other: &Delimiter) -> bool

impl RefUnwindSafe for Delimiter

impl Send for Delimiter

impl StructuralPartialEq for Delimiter

impl Sync for Delimiter

impl Unpin for Delimiter

impl UnwindSafe for Delimiter

impl<T> Any for Delimiter

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Delimiter

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Delimiter

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for Delimiter

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for Delimiter

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Delimiter

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for Delimiter

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Delimiter

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Delimiter

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>