macro_rules! derive_deftly_template_NetdocParseableUnverified {
({ $($driver:tt)* } [$($aoptions:tt)*] ($($future:tt)*) $($tpassthrough:tt)*) => { ... };
($($wrong:tt)*) => { ... };
}Expand description
Derive NetdocParseable for a top-level signed document
§Expected input structure
Apply this derive to the main body struct Foo,
which should meet all the requirements to derive
NetdocParseable.
Usually, the caller will provide suitable ad-hoc .verify_... methods
on FooUnverified.
§Generated code
Supposing your input structure is Foo, this macro will
generate a **struct FooUnverified**
implementing NetdocParseable and NetdocUnverified:
pub struct FooUnverified {
body: Foo,
pub sigs: SignaturesData<FooUnverified>,
}Also generated is FooUnverifiedParsedBody
and an impl of HasUnverifiedParsedBody on Foo.
These allow the generated code to call ItemStream::parse_signed
and it should not normally be necessary to use them elsewhere.
§Required top-level attributes:
-
#[deftly(netdoc(signature = TYPE))]: Type of the signature(s) section.TYPE must implement
NetdocParseable, withis_intro_item_keywordreporting every signature keyword. Normally this is achieved with#[derive_deftly(NetdocParseable)] #[deftly(netdoc(signatures))].
§Optional attributes
All the attributes supported by the NetdocParseable derive are supported.
This is a derive_deftly template. Do not invoke it directly.
To use it, write: #[derive(Deftly)] #[derive_deftly(NetdocParseableUnverified)].