define_validated_struct_type

Macro define_validated_struct_type 

Source
macro_rules! define_validated_struct_type {
    (
        $StructName:ident,
        $PolicyType:ident,
        $RawType:ident,
        $doc:literal,
        $display_string:literal
    ) => { ... };
}
Expand description

Defines the validated struct with documentation and serialization support.

Creates a #[repr(transparent)] newtype wrapper around the raw type with:

  • Automatic AsRef, Debug, Display, LowerExp derives
  • Serde Serialize and Deserialize support
  • Phantom data for kernel type

§Example

define_validated_struct_type!(
    RealValidated,
    RealPolicy,
    RawReal,
    "A validated real number wrapper",
    "{value}"
);

§Parameters

  • $StructName: Name of the struct (e.g., RealValidated)
  • $PolicyType: Policy field in NumKernel (e.g., RealPolicy)
  • $RawType: Raw value type (e.g., RawReal)
  • $doc: Documentation string
  • $display_string: Format string for Display/LowerExp (e.g., "{value}")