pub struct Singleton {
    pub attrs: Vec<Attribute>,
    pub token: Struct,
    pub generics: Generics,
    pub style: StructStyle,
    pub fields: Punctuated<SingletonField, Comma>,
    pub impls: Vec<ItemImpl>,
}
Expand description

A struct with a single instantiation

The singleton macro may be used to conveniently declare a struct’s type, implementations and construct an instance. This struct represents the macro’s input.

Fields§

§attrs: Vec<Attribute>

Struct attributes

§token: Struct

struct token

§generics: Generics

(Explicit) struct generics

Note: the macro instantiated type may have extra generics.

§style: StructStyle

Struct style: unit/tuple/regular

§fields: Punctuated<SingletonField, Comma>

Struct fields

§impls: Vec<ItemImpl>

(Explicit) struct implementations

Implementations§

Trait Implementations§

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.