Skip to main content

name_type

Macro name_type 

Source
macro_rules! name_type {
    (
        $(#[$meta:meta])*
        $vis:vis struct $Name:ident {
            kind: $kind:literal
            $(, max_len: $max_len:expr )?
            $(,)?
        }
    ) => { ... };
}
Expand description

Declare a validated name newtype that implements Name.

Used across the crate wherever a validated ASCII-identifier newtype is needed (parameter names, element names, label keys, port names, …). Each invocation produces a newtype with:

  • new, as_str, into_inner
  • Display, Debug, PartialEq/Eq/Hash/Ord/PartialOrd
  • serde Serialize / Deserialize as a transparent string
  • FromStr, TryFrom<&str>, TryFrom<String>