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 might 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

fn assert_fields_are_eq(&self)

impl Mark for Delimiter

type Unmarked = Delimiter;
fn mark(unmarked: Self::Unmarked) -> Self
fn unmark(self) -> Self::Unmarked

impl PartialEq for Delimiter

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

impl StructuralPartialEq for Delimiter

impl TrivialClone for Delimiter

impl<'a, S> Decode<'a, '_, S> for Delimiter

fn decode(r: &mut &'a [u8], s: &mut S) -> Self

impl<S> Encode<S> for Delimiter

fn encode(self, w: &mut Buffer, s: &mut S)

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> Printable for Delimiter where T: Copy + Debug,

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

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for Delimiter

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>