macro_rules! late_field {
(
$($ty:ty [$ns:ty] $(=> $val:ty)?),*
$(,)?
) => { ... };
}Expand description
Implements the LateField trait for the specified $ty type, turning it into a marker type
that can be used to refer to a field within a late-initialized structure.
See the crate level documentation for examples of this macro in action as well as a step-by-step guide on how to use it.
The $ns type specifies a LateStruct (defined by an earlier
late_struct! invocation) into which this field will be placed. The
optional $val type specifies the type of the value this field stores. If $val is omitted, it
will default to $ty.
$val (or $ty, if $val is omitted) is expected to live for 'static, be Sized, and
implement Default. It is this Default trait implementation which is used to initialize the
fields of a LateInstance. In addition, the field value must be able to
coerce into the $ns structure type’s LateStruct::EraseTo associated type. By default, the
LateStruct::EraseTo associated type is set to dyn 'static + fmt::Debug and thus $val will
be expected to implement Debug as well.
If $val is distinct from $ty, the $ty type need only be Sized and live for 'static.
No types in this macro invocation may involve unbound generic parameters. You can specify more
than one type onto which LateField should be implemented with this macro.