Derive Macro bytecheck::CheckBytes
source ยท #[derive(CheckBytes)]
{
// Attributes available to this derive:
#[check_bytes]
#[omit_bounds]
}
Expand description
Derives CheckBytes
for the labeled type.
Additional arguments can be specified using the #[check_bytes(...)]
attribute:
bound = "..."
: Adds additional bounds to theCheckBytes
implementation. This can be especially useful when dealing with recursive structures, where bounds may need to be omitted to prevent recursive type definitions.
This derive macro automatically adds a type bound field: CheckBytes<__C>
for each field type.
This can cause an overflow while evaluating trait bounds if the structure eventually references
its own type, as the implementation of CheckBytes
for a struct depends on each field type
implementing it as well. Adding the attribute #[omit_bounds]
to a field will suppress this
trait bound and allow recursive structures. This may be too coarse for some types, in which case
additional type bounds may be required with bound = "..."
.