Skip to main content

FormatConvert

Derive Macro FormatConvert 

Source
#[derive(FormatConvert)]
Expand description

Derive macro for format-typed struct conversions.

For structs generic over F: Format (e.g. SummaryDetail<F: Format = Both>), generates:

  • impl From<Struct<Both>> for Struct<Raw> — extracts .raw from each FormattedValue field
  • impl From<Struct<Both>> for Struct<Pretty> — extracts .fmt (or .long_fmt) instead
  • Convenience methods on Struct<Both>: into_raw(), as_raw(), into_pretty(), as_pretty()

Field classification:

  • Option<F::Value<T>> (any 2-segment path ending in ::Value) → formatted field
  • Everything else → plain field, copied as-is