Derive Macro neli::FromBytesWithInput

source ·
#[derive(FromBytesWithInput)]
{
    // Attributes available to this derive:
    #[neli]
}
Expand description

Derives the neli FromBytesWithInput trait for a struct.

Acceptable struct attribute is:

  • #[neli(from_bytes_bound = "T: MyTrait")] which will generate a trait bound in the impl for the specified type parameter.
  • #[neli(padding)] which will add special handling for padding for this struct.

Acceptable field attribute forms are:

  • #[neli(input = "input_expression")] which may only be used once for a struct. The behavior of this attribute is that a bound requirement will change from the implicit FromBytes to an implicit FromBytesWithInput bound. The method in this trait will be called with input_expression as the input provided.
  • #[neli(input)] which will transparently pass the input provided in the FromBytesWithInput method through to the FromBytesWithInput method for this field unchanged according to the rules described above.
  • #[neli(size = "size_var_name")] which allows specifying a size of the data type that is different from the input specified by #[neli(input)]. Not specifying this attribute defaults to using input as the size as well.

Implicit type parameter bound: FromBytes.