macro_rules! derive_deftly_template_ConstantString {
({ $($driver:tt)* } [$($aoptions:tt)*] ($($future:tt)*) $($tpassthrough:tt)*) => { ... };
($($wrong:tt)*) => { ... };
}Expand description
Derive all parsing and encoding for a fixed, constant, string
Usually, use the more-cooked [define_constant_string!] macro instead.
§Input
Typically, a unit struct.
(Can be applied to any ZST struct that implements Default.)
§Required attribute
#[deftly(constant_string = EXPR))]whereEXPRis a&strexpression.
§Generated items
Implementations of [FromStr, Display, and NormalItemArgument].
Therefore also ItemArgument
and ItemArgumentParseable.
§Example
use derive_deftly::Deftly;
use tor_netdoc::derive_deftly_template_ConstantString;
#[derive(Default, Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash, Deftly)]
#[derive_deftly(ConstantString)]
#[deftly(constant_string = "sha3-256")]
#[allow(clippy::exhaustive_structs)]
pub struct SharedRandV1AlgName;This is a derive_deftly template. Do not invoke it directly.
To use it, write: #[derive(Deftly)] #[derive_deftly(ConstantString)].