Crate neli_proc_macros
source · [−]Expand description
Procedural macros to be used with the library
neli
.
All derive macros other than Header
generate implicit type
parameter bounds on every type parameter which can be overriden
with struct attributes.
Attribute Macros
Converts an enum from the form:
Derive Macros
Derives the neli FromBytes
trait for a struct.
Derives the neli FromBytesWithInput
trait for a struct.
Derives the neli Header
trait for a struct or enum. Unlike
other derive macros in this crate, the Header
derive macro
does not impose type parameter bounds on type parameters.
See the accepted attribute for more information. The reason for
this is that the last field is considered to be the payload.
Because the payload may be represented by a type parameter,
we cannot blindly restrict type parameters or else we impose
an artificial restriction of TypeSize
on the payload type
parameter. This is a problem for the Header
trait as the
payload may be unsized even if the rest of the header is
composed exclusively of statically sized types and are therefore
compatible with the TypeSize
trait.
Derives the neli Size
trait for a struct or enum.
Derives the neli ToBytes
trait for a struct or enum.