pub struct StructType { /* private fields */ }Expand description
This represents a structured aggregate type
Implementations§
Source§impl StructType
impl StructType
Sourcepub fn new<I: IntoIterator<Item = Type>>(fields: I) -> Self
pub fn new<I: IntoIterator<Item = Type>>(fields: I) -> Self
Create a new struct with default representation, i.e. a struct with representation of
TypeRepr::Packed(1).
Sourcepub fn new_with_repr<I: IntoIterator<Item = Type>>(
repr: TypeRepr,
fields: I,
) -> Self
pub fn new_with_repr<I: IntoIterator<Item = Type>>( repr: TypeRepr, fields: I, ) -> Self
Create a new struct with the given representation.
This function will panic if the rules of the given representation are violated.
Sourcepub fn min_alignment(&self) -> usize
pub fn min_alignment(&self) -> usize
Get the minimum alignment for this struct
Sourcepub fn size(&self) -> usize
pub fn size(&self) -> usize
Get the total size in bytes required to hold this struct, including alignment padding
Sourcepub fn get(&self, index: usize) -> &StructField
pub fn get(&self, index: usize) -> &StructField
Get the struct field at index, relative to declaration order.
Sourcepub fn fields(&self) -> &[StructField]
pub fn fields(&self) -> &[StructField]
Get the struct fields as a slice
Trait Implementations§
Source§impl Clone for StructType
impl Clone for StructType
Source§fn clone(&self) -> StructType
fn clone(&self) -> StructType
Returns a duplicate of the value. Read more
1.0.0 · 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 StructType
impl Debug for StructType
Source§impl<'de> Deserialize<'de> for StructType
impl<'de> Deserialize<'de> for StructType
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for StructType
impl Display for StructType
Source§impl From<StructType> for Type
impl From<StructType> for Type
Source§fn from(ty: StructType) -> Type
fn from(ty: StructType) -> Type
Converts to this type from the input type.
Source§impl Hash for StructType
impl Hash for StructType
Source§impl PartialEq for StructType
impl PartialEq for StructType
Source§impl PrettyPrint for StructType
impl PrettyPrint for StructType
Source§fn to_pretty_string(&self) -> String
fn to_pretty_string(&self) -> String
Source§fn pretty_print(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn pretty_print(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Pretty-print this object to the given core::fmt::Formatter. Read more
Source§impl Serialize for StructType
impl Serialize for StructType
Source§impl TryFrom<Type> for StructType
impl TryFrom<Type> for StructType
impl Eq for StructType
impl StructuralPartialEq for StructType
Auto Trait Implementations§
impl Freeze for StructType
impl RefUnwindSafe for StructType
impl Send for StructType
impl Sync for StructType
impl Unpin for StructType
impl UnwindSafe for StructType
Blanket Implementations§
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