pub struct RecordDef {Show 15 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 stands_for: Option<&'static str>,
pub range: SourceRange,
}Expand description
A struct or union tag.
Fields§
§kind: RecordKindWhether this is a struct or a union.
tag: Option<String>The C tag, absent for an anonymous struct { … }.
rust_name: StringThe name of the generated Rust item, already made unique.
anonymous: boolWhether 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: boolWhether 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: u64The 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: boolWhether the record ends in a flexible array member.
emit: boolWhether an item should be generated for this tag.
stands_for: Option<&'static str>The C type this record stands in for, when it is not a record in C at
all: _Float128, which may be named but never computed with, is a
struct of sixteen bytes here. Diagnostics name the C type.
range: SourceRangeWhere the tag was defined (or first mentioned).