pub enum TypeVariant<I: Layout> {
Builtin(BuiltinType),
Record(Record<I>),
Typedef(Box<Type<I>>),
Array(Array<I>),
Enum(Vec<i128>),
Opaque(I::OpaqueLayout),
}
Expand description
An enum of all available types.
Variants§
Builtin(BuiltinType)
A builtin type.
Record(Record<I>)
A record. Struct or union.
Typedef(Box<Type<I>>)
A typedef.
The box contains the target type.
Array(Array<I>)
An array.
Enum(Vec<i128>)
An enum.
The vector contains the values of the variants.
Opaque(I::OpaqueLayout)
An opaque type.
This does not correspond to anything in C. It is useful if the layout of a nested type is already known and should not be recomputed. On all supported targets, substituting a type for the opaque type with the same layout leads to the same layout for the containing type.
Implementations§
Source§impl<I: Layout> TypeVariant<I>
impl<I: Layout> TypeVariant<I>
Sourcepub fn into<J: Layout>(self) -> TypeVariant<J>where
I::TypeLayout: Into<J::TypeLayout>,
I::FieldLayout: Into<J::FieldLayout>,
I::OpaqueLayout: Into<J::OpaqueLayout>,
pub fn into<J: Layout>(self) -> TypeVariant<J>where
I::TypeLayout: Into<J::TypeLayout>,
I::FieldLayout: Into<J::FieldLayout>,
I::OpaqueLayout: Into<J::OpaqueLayout>,
Returns the identical type variant with the Layout
converted.
Trait Implementations§
Source§impl<I: Clone + Layout> Clone for TypeVariant<I>where
I::OpaqueLayout: Clone,
impl<I: Clone + Layout> Clone for TypeVariant<I>where
I::OpaqueLayout: Clone,
Source§fn clone(&self) -> TypeVariant<I>
fn clone(&self) -> TypeVariant<I>
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<I: Debug + Layout> Debug for TypeVariant<I>where
I::OpaqueLayout: Debug,
impl<I: Debug + Layout> Debug for TypeVariant<I>where
I::OpaqueLayout: Debug,
Source§impl<I: PartialEq + Layout> PartialEq for TypeVariant<I>where
I::OpaqueLayout: PartialEq,
impl<I: PartialEq + Layout> PartialEq for TypeVariant<I>where
I::OpaqueLayout: PartialEq,
impl<I: Eq + Layout> Eq for TypeVariant<I>where
I::OpaqueLayout: Eq,
impl<I: Layout> StructuralPartialEq for TypeVariant<I>
Auto Trait Implementations§
impl<I> Freeze for TypeVariant<I>
impl<I> RefUnwindSafe for TypeVariant<I>where
<I as Layout>::OpaqueLayout: RefUnwindSafe,
<I as Layout>::TypeLayout: RefUnwindSafe,
<I as Layout>::FieldLayout: RefUnwindSafe,
impl<I> Send for TypeVariant<I>where
<I as Layout>::OpaqueLayout: Send,
<I as Layout>::TypeLayout: Send,
<I as Layout>::FieldLayout: Send,
impl<I> Sync for TypeVariant<I>where
<I as Layout>::OpaqueLayout: Sync,
<I as Layout>::TypeLayout: Sync,
<I as Layout>::FieldLayout: Sync,
impl<I> Unpin for TypeVariant<I>where
<I as Layout>::OpaqueLayout: Unpin,
<I as Layout>::FieldLayout: Unpin,
<I as Layout>::TypeLayout: Unpin,
impl<I> UnwindSafe for TypeVariant<I>where
<I as Layout>::OpaqueLayout: UnwindSafe,
<I as Layout>::TypeLayout: UnwindSafe,
<I as Layout>::FieldLayout: UnwindSafe,
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