macro_rules! CType {
(
$(
@doc_meta( $($doc_meta:tt)* )
)?
#[repr(C $(, js $(@$js:tt)?)? $(,)?)]
$(#[$($meta:tt)*])*
$pub:vis
struct $StructName:ident $(
[
$($lt:lifetime ,)*
$($($generics:ident $(= $Default:ty)?),+ $(,)?)?
]
$(where { $($bounds:tt)* })?
)?
{
$(
$(#[$($field_meta:tt)*])*
$field_pub:vis
$field_name:ident : $field_ty:ty
),+ $(,)?
}
) => { ... };
(
@js_enum
$Enum_Layout:ident {
$(
$Variant:ident = $Discriminant:expr
),* $(,)?
}
) => { ... };
}
Expand description
Safely implement CType
for a #[repr(C)]
struct when all its fields are CType
.
Note: you rarely need to call this macro directly. Instead, look for the
ReprC!
macro to safely implement ReprC
.