Struct midenc_hir_type::StructType
source · 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 copy 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 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§fn eq(&self, other: &StructType) -> bool
fn eq(&self, other: &StructType) -> bool
This method tests for
self and other values to be equal, and is used
by ==.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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)