pub struct StructDecl {
pub name: String,
pub packed: bool,
pub fields: Vec<StructField>,
pub span: Range<usize>,
}Expand description
A struct type declaration: struct Name { field: Type; ... }.
Struct names use UpperCamelCase by convention. Fields are flat — no
collection types, no pointers (#107); a field may be another declared
struct, but recursion (direct or indirect) is rejected so sizeof is
always computable at compile time. @attr(packed) before struct
drops the padding, as C’s __attribute__((packed)).
Fields§
§name: StringType name.
packed: boolPacked: no padding, alignment 1.
fields: Vec<StructField>Fields, in declaration (and layout) order.
span: Range<usize>Byte span of the declaration in the source.
Trait Implementations§
Source§impl Clone for StructDecl
impl Clone for StructDecl
Source§fn clone(&self) -> StructDecl
fn clone(&self) -> StructDecl
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StructDecl
impl Debug for StructDecl
Source§impl Display for StructDecl
impl Display for StructDecl
Source§impl PartialEq for StructDecl
impl PartialEq for StructDecl
Source§fn eq(&self, other: &StructDecl) -> bool
fn eq(&self, other: &StructDecl) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for StructDecl
impl Serialize for StructDecl
impl StructuralPartialEq for StructDecl
Auto Trait Implementations§
impl Freeze for StructDecl
impl RefUnwindSafe for StructDecl
impl Send for StructDecl
impl Sync for StructDecl
impl Unpin for StructDecl
impl UnsafeUnpin for StructDecl
impl UnwindSafe for StructDecl
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.