Expand description
Derive macros for zerocopyβs traits.
ModulesΒ§
MacrosΒ§
- derive π
- Defines a derive function named
$outerwhich parses its inputTokenStreamas aDeriveInputand then invokes the$innerfunction.
StructsΒ§
- Impl
Block πBuilder
EnumsΒ§
- Field
Bounds π - Padding
Check π - This enum describes what kind of padding check needs to be generated for the associated impl.
- Self
Bounds π - Trait π
- Trait
Bound π
TraitsΒ§
- BoolExt π
- Into
Token πStream
FunctionsΒ§
- derive_
eq_ πinner - derive_
from_ πbytes_ enum - An enum is
FromBytesif: - derive_
from_ πbytes_ inner - derive_
from_ πbytes_ struct - A struct is
FromBytesif: - derive_
from_ πbytes_ union - Unions are
FromBytesif - derive_
from_ πzeros_ enum - An enum is
FromZerosif: - derive_
from_ πzeros_ inner - derive_
from_ πzeros_ struct - A struct is
FromZerosif: - derive_
from_ πzeros_ union - Unions are
FromZerosif - 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
IntoBytesif: - 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
TryFromBytesif: - derive_
try_ πfrom_ bytes_ union - A union is
TryFromBytesif: - derive_
unaligned_ πenum - An enum is
Unalignedif: - derive_
unaligned_ πinner - derive_
unaligned_ πstruct - A struct is
Unalignedif: - derive_
unaligned_ πunion - Like structs, a union is
Unalignedif: - enum_
size_ πfrom_ repr - extract_
zerocopy_ πcrate - Attempt to extract a crate path from the provided attributes. Defaults to
::zerocopyif not found. - find_
zero_ πvariant - Returns
Ok(index)if variantindexof the enum has a discriminant of zero. IfErr(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_validinstance that unconditionally returns true. - normalize_
bounds π - Normalizes a slice of bounds by replacing
TraitBound::Slfwithslf. - try_
gen_ πtrivial_ is_ bit_ valid - Attempts to generate a
TryFromBytes::is_bit_validinstance that unconditionally returns true.