Crate zerocopy_derive

Crate zerocopy_derive 

Source
Expand description

Derive macros for zerocopy’s traits.

ModulesΒ§

enum πŸ”’
ext πŸ”’
repr πŸ”’

MacrosΒ§

derive πŸ”’
Defines a derive function named $outer which parses its input TokenStream as a DeriveInput and then invokes the $inner function.

StructsΒ§

ImplBlockBuilder πŸ”’

EnumsΒ§

FieldBounds πŸ”’
PaddingCheck πŸ”’
This enum describes what kind of padding check needs to be generated for the associated impl.
SelfBounds πŸ”’
Trait πŸ”’
TraitBound πŸ”’

TraitsΒ§

BoolExt πŸ”’
IntoTokenStream πŸ”’

FunctionsΒ§

derive_eq_inner πŸ”’
derive_from_bytes_enum πŸ”’
An enum is FromBytes if:
derive_from_bytes_inner πŸ”’
derive_from_bytes_struct πŸ”’
A struct is FromBytes if:
derive_from_bytes_union πŸ”’
Unions are FromBytes if
derive_from_zeros_enum πŸ”’
An enum is FromZeros if:
derive_from_zeros_inner πŸ”’
derive_from_zeros_struct πŸ”’
A struct is FromZeros if:
derive_from_zeros_union πŸ”’
Unions are FromZeros if
derive_hash_inner πŸ”’
derive_into_bytes_enum πŸ”’
If the type is an enum:
derive_into_bytes_inner πŸ”’
derive_into_bytes_struct πŸ”’
derive_into_bytes_union πŸ”’
A union is IntoBytes if:
derive_known_layout_inner πŸ”’
derive_no_cell_inner πŸ”’
derive_split_at_inner πŸ”’
derive_try_from_bytes_enum πŸ”’
derive_try_from_bytes_inner πŸ”’
derive_try_from_bytes_struct πŸ”’
A struct is TryFromBytes if:
derive_try_from_bytes_union πŸ”’
A union is TryFromBytes if:
derive_unaligned_enum πŸ”’
An enum is Unaligned if:
derive_unaligned_inner πŸ”’
derive_unaligned_struct πŸ”’
A struct is Unaligned if:
derive_unaligned_union πŸ”’
Like structs, a union is Unaligned if:
enum_size_from_repr πŸ”’
extract_zerocopy_crate πŸ”’
Attempt to extract a crate path from the provided attributes. Defaults to ::zerocopy if not found.
find_zero_variant πŸ”’
Returns Ok(index) if variant index of the enum has a discriminant of zero. If Err(bool) is returned, the boolean is true if the enum has unknown discriminants (e.g. discriminants set to const expressions which we can’t evaluate in a proc macro). If the enum has unknown discriminants, then it might have a zero variant that we just can’t detect.
gen_trivial_is_bit_valid_unchecked πŸ”’ ⚠
Generates a TryFromBytes::is_bit_valid instance that unconditionally returns true.
normalize_bounds πŸ”’
Normalizes a slice of bounds by replacing TraitBound::Slf with slf.
try_gen_trivial_is_bit_valid πŸ”’
Attempts to generate a TryFromBytes::is_bit_valid instance that unconditionally returns true.

Derive MacrosΒ§

ByteEq
ByteHash
FromBytes
FromZeros
Immutable
IntoBytes
KnownLayout
SplitAt
TryFromBytes
Unaligned