Enum Delimiter

pub 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.

Trait Implementations

impl Clone for Delimiter

fn clone(&self) -> Delimiter

impl Copy for Delimiter

impl Debug for Delimiter

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

impl Eq for Delimiter

impl PartialEq for Delimiter

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

impl StructuralPartialEq for Delimiter

Auto Trait Implementations

impl Freeze for Delimiter

impl RefUnwindSafe for Delimiter

impl Send for Delimiter

impl Sync for Delimiter

impl Unpin for Delimiter

impl UnsafeUnpin for Delimiter

impl UnwindSafe for Delimiter

Blanket Implementations

impl<T> Any for Delimiter where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Delimiter where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Delimiter where T: ?Sized,

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

impl<T> CloneToUninit for Delimiter where T: Clone,

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

impl<T> From<T> for Delimiter

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Delimiter where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for Delimiter where U: From<T>,

fn into(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<U> for Delimiter where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Delimiter where U: TryFrom<T>,

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