aspartial
Types that represent some type in a serialized payload can implement
AsPartial to specify what that structure would look like when incomplete.
use AsPartial;
// A struct like this...
// ...would have a 'partial' representation like this, usually generated
// via #[derive(AsPartial)].
// And an enum like this...
// ...would have a 'partial' representation like this, also usually
// auto-generated via #[derive(AsPartial)]
// that is, the partial version of an enum doesn't really know which variant
// it represents (in fact, all variants could have identical fields), so a partial
// enum is a struct composed of all variants that may or may not exist.
// Note that each field type in in the original MyStruct and every variant
// in the original MyEnum must also implement AsPartial:
Note that AsPartial::Partial also implements AsPartial, so that any
arbitrarily nested field is also allowed to be absent. This crate should provide
implementations for all primitive types.