Skip to main content

GroupWithMetadata

Struct GroupWithMetadata 

Source
pub struct GroupWithMetadata<G, I = G, P = G, L = I> {
    pub delimiter: Delimiter,
    pub contents: TokenWithMetadataVec<G, I, P, L>,
    pub span: Span,
    pub metadata: G,
}
Expand description

A version of Group with arbitrary attached metadata. The tokens within this GroupWithMetadata also have metadata.

The fields of this struct are public, unlike Group’s. There are no getter/setter methods: use the fields directly.

See proc_macro2’s documentation for more information on Group.

Fields§

§delimiter: Delimiter§contents: TokenWithMetadataVec<G, I, P, L>

A vector holding the tokens within this group, each with their own metadata.

§span: Span

See Group::span. This span covers the entire group, including the delimiters.

§metadata: G

The associated metadata.

Implementations§

Source§

impl<G, I, P, L> GroupWithMetadata<G, I, P, L>

Source

pub fn strip_metadata(self) -> Group

Strips the metadata from this GroupWithMetadata, returning an ordinary Group.

The tokens within the group will also be stripped of their metadata.

Source

pub fn delimiter(&self) -> Delimiter

👎Deprecated:

Use the delimiter field directly.

Source

pub fn span(&self) -> Span

👎Deprecated:

Use the span field directly.

Source

pub fn span_open(&self) -> Span

Source

pub fn span_close(&self) -> Span

Source

pub fn delim_span(&self) -> DelimSpan

Source

pub fn set_span(&mut self, span: Span)

👎Deprecated:

Use the span field directly.

Trait Implementations§

Source§

impl<G: Clone, I: Clone, P: Clone, L: Clone> Clone for GroupWithMetadata<G, I, P, L>

Source§

fn clone(&self) -> GroupWithMetadata<G, I, P, L>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<G: Debug, I: Debug, P: Debug, L: Debug> Debug for GroupWithMetadata<G, I, P, L>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<G, I, P, L> From<(Group, &G, &I, &P, &L)> for GroupWithMetadata<G, I, P, L>
where G: Clone, I: Clone, P: Clone, L: Clone,

Source§

fn from((value, g, i, p, l): (Group, &G, &I, &P, &L)) -> Self

Converts to this type from the input type.
Source§

impl<T> From<(Group, &T)> for GroupWithMetadata<T>
where T: Clone,

Source§

fn from((value, metadata): (Group, &T)) -> Self

Converts to this type from the input type.
Source§

impl<G, I, P, L> From<Group> for GroupWithMetadata<G, I, P, L>
where G: Default, I: Default, P: Default, L: Default,

Source§

fn from(value: Group) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<G, I = G, P = G, L = I> !Send for GroupWithMetadata<G, I, P, L>

§

impl<G, I = G, P = G, L = I> !Sync for GroupWithMetadata<G, I, P, L>

§

impl<G, I, P, L> Freeze for GroupWithMetadata<G, I, P, L>
where G: Freeze,

§

impl<G, I, P, L> RefUnwindSafe for GroupWithMetadata<G, I, P, L>

§

impl<G, I, P, L> Unpin for GroupWithMetadata<G, I, P, L>
where G: Unpin, I: Unpin, P: Unpin, L: Unpin,

§

impl<G, I, P, L> UnsafeUnpin for GroupWithMetadata<G, I, P, L>
where G: UnsafeUnpin,

§

impl<G, I, P, L> UnwindSafe for GroupWithMetadata<G, I, P, L>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.