Skip to main content

Crate pogo_masterfile_macros

Crate pogo_masterfile_macros 

Source
Expand description

Procedural derive macros backing the [pogo-masterfile-types] crate.

This crate is normally consumed transparently via re-exports from pogo-masterfile-types. Direct dependency is fine but not required.

Derive Macros§

AllVariants
Derives pub const ALL: [Self; N] and pub const SIZE: usize for a unit-only enum. Visibility of the constants follows the enum’s own visibility.
AsStr
Derives pub const fn as_str(&self) -> &'static str and impl Display for a unit-only enum. Each variant’s string is taken from a #[serde(rename = "...")] attribute; if absent, falls back to stringify!(VariantIdent).
FromStrEnum
Derives impl FromStr AND impl TryFrom<&str> for a unit-only enum. Both share the same string-matching logic: #[serde(rename = "...")] first, variant ident otherwise. The error type is pogo_masterfile_types::UnknownTemplateId — the macro emits a path reference; consumers must have that type in scope (which they do transparently via the parent crate).
TemplateId
Derives an inherent template_id(&self) -> &str method for an enum whose every variant is a single-field tuple wrapping a struct with a template_id: String field.