Skip to main content

RecordDef

Struct RecordDef 

Source
pub struct RecordDef {
Show 14 fields pub kind: RecordKind, pub tag: Option<String>, pub rust_name: String, pub anonymous: bool, pub fields: Vec<Field>, pub rust_fields: Vec<RustField>, pub complete: bool, pub layout: Option<Layout>, pub align: Option<u64>, pub packed: Option<u64>, pub rust_align: u64, pub flexible: bool, pub emit: bool, pub range: SourceRange,
}
Expand description

A struct or union tag.

Fields§

§kind: RecordKind

Whether this is a struct or a union.

§tag: Option<String>

The C tag, absent for an anonymous struct { … }.

§rust_name: String

The name of the generated Rust item, already made unique.

§anonymous: bool

Whether rust_name is still the synthetic name given to an anonymous tag, and may therefore be replaced by the name of a typedef of it.

§fields: Vec<Field>

The members, in declaration order. Empty while the tag is incomplete.

An unnamed bit-field is not here: it declares no member, so nothing can name it and no initialiser reaches it. It still occupies bits, and RecordDef::rust_fields accounts for them.

§rust_fields: Vec<RustField>

The fields of the generated Rust item, in order.

§complete: bool

Whether a member list has been seen.

§layout: Option<Layout>

The layout, computed once the tag is complete.

§align: Option<u64>

The alignment _Alignas on a member raised the record to, which becomes #[repr(C, align(N))] on the generated item.

§packed: Option<u64>

The maximum member alignment __attribute__((packed)) or #pragma pack(N) asked for, which becomes #[repr(C, packed(N))].

§rust_align: u64

The alignment the generated Rust item has, which is Layout::align except for a packed record — Rust refuses packed and align(N) together, so such an item is one byte aligned however strict C says the record is. Laying out a record that has one as a member reads this rather than the C alignment, so that the padding it inserts puts the member where both sides agree it goes.

§flexible: bool

Whether the record ends in a flexible array member.

§emit: bool

Whether an item should be generated for this tag.

§range: SourceRange

Where the tag was defined (or first mentioned).

Trait Implementations§

Source§

impl Clone for RecordDef

Source§

fn clone(&self) -> Self

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 Debug for RecordDef

Source§

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

Formats the value using the given formatter. Read more

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

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.