macro_rules! derive_deftly_template_ItemValueEncodable {
({ $($driver:tt)* } [$($aoptions:tt)*] ($($future:tt)*) $($tpassthrough:tt)*) => { ... };
($($wrong:tt)*) => { ... };
}Expand description
Derive ItemValueEncodable
Fields in the struct are emitted as keyword line arguments, in the order they appear in the struct.
§Field type
Each field should be:
implItemArgument(one argument),Option<impl ItemArgument>(one optional argument), orVec<impl ItemArgument + EncodeOrd>(zero or more arguments).BTreeSet<impl ItemArgument>(zero or more arguments).
ItemArgument can be implemented via impl Display,
by writing impl NormalItemArgument.
(Multiplicity is implemented via types in the multiplicity module,
specifically MultiplicitySelector and MultiplicityMethods.)
§Top-level attributes:p
-
`#[deftly(netdoc(no_extra_args))]:
Ignored. (Obviously, the encoder never emits arguments that aren’t in the document struct.)
Accepted for alignment with
ItemValueParseable, so that a struct which only conditionally derivesItemValueParseabledoes not need to conditionally mark this attribute.(May not be combined with
#[deftly(netdoc(rest))].) -
#[deftly(netdoc(debug))]:Currently implemented only as a placeholder
The generated implementation may in future generate copious debug output to the program’s stderr when it is run. Do not enable in production!
§Field-level attributes:
-
`#[deftly(netdoc(rest))]:
The field is the whole rest of the line. Must come after any other normal argument fields. Only allowed once.
The field type must implement
ToString(normally, viaDisplay). (I.e.Vec,Optionetc., are not allowed, andItemArgumenis not used.) -
`#[deftly(netdoc(object))]:
The field is the Object. It must implement
ItemObjectEncodable. (or beOption<impl ItemObjectEncodable>).Only allowed once.
-
`#[deftly(netdoc(object(label = “LABEL”)))]:
Sets the expected label for an Object. If not supplied, uses
ItemObjectEncodable::label. -
`#[deftly(netdoc(with = MODULE)]:
Instead of
ItemArgument, the argument is encoded withMODULE::write_arg_onto, which must have the same signature asItemArgument::write_arg_onto.With
#[deftly(netdoc(rest))],MODULE::fmt_args_restreplacesDisplay::fmt.With
#[deftly(netdoc(object))], usesMODULE::write_object_ontoinstead oftor_netdoc::Writeable::write_onto. LABEL must also be specified unless the object also implementsItemObjectEncodable. -
`#[deftly(netdoc(sig_hash = HASH_METHOD))]:
TODO NETDOC ENCODE. Encoding of signed documents is not yet implemented.
-
`#[deftly(netdoc(skip))]:
Do not encode this field.
This is a derive_deftly template. Do not invoke it directly.
To use it, write: #[derive(Deftly)] #[derive_deftly(ItemValueEncodable)].