Skip to main content

TypeSpec

Enum TypeSpec 

Source
pub enum TypeSpec {
    None,
    Builtin(Builtin),
    Record {
        kind: RecordKind,
        tag: Option<Symbol>,
        fields: Option<MemberList>,
        attrs: AttrList,
    },
    Enum {
        tag: Option<Symbol>,
        enumerators: Option<EnumeratorList>,
        underlying: Option<TypeNameId>,
        attrs: AttrList,
    },
    Typedef(Symbol),
    Typeof {
        unqual: bool,
        operand: TypeofArg,
    },
    Atomic(TypeNameId),
    Auto(Deduction),
}
Expand description

What type a declaration named.

Variants§

§

None

Nothing was written, which is int before C23 with a warning and an error in it.

§

Builtin(Builtin)

One or more of the keywords that name a built-in type.

§

Record

struct or union, with or without a tag, with or without a body.

Fields

§kind: RecordKind

Which of the two.

§tag: Option<Symbol>

The tag, absent for an anonymous one.

§fields: Option<MemberList>

The members, absent when this is a reference to a tag rather than a definition. An empty list is a definition of an empty structure, which is a GNU extension, so the difference between struct S; and struct S {}; has to survive.

§attrs: AttrList

Attributes on the tag itself, which GCC allows both before and after the body.

§

Enum

enum, with C23’s optional underlying type.

Fields

§tag: Option<Symbol>

The tag, absent for an anonymous one.

§enumerators: Option<EnumeratorList>

The enumerators, absent when this is a reference rather than a definition.

§underlying: Option<TypeNameId>

The : T that C23 added, which fixes the representation instead of leaving it to the implementation.

§attrs: AttrList

Attributes on the tag itself.

§

Typedef(Symbol)

An identifier the parser’s scope stack said was a typedef name.

§

Typeof

typeof or typeof_unqual, or their __typeof__ spellings.

Fields

§unqual: bool

Whether the qualifiers come off, which is what typeof_unqual is for.

§operand: TypeofArg

The operand, which is an expression or a type name and in the expression case is never evaluated.

§

Atomic(TypeNameId)

_Atomic(T), the type constructor rather than the qualifier.

§

Auto(Deduction)

A type deduced from an initializer, which is C23’s auto and GNU’s __auto_type.

Trait Implementations§

Source§

impl Clone for TypeSpec

Source§

fn clone(&self) -> TypeSpec

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 Copy for TypeSpec

Source§

impl Debug for TypeSpec

Source§

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

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

impl Eq for TypeSpec

Source§

impl PartialEq for TypeSpec

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TypeSpec

Auto Trait Implementations§

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 = !

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.