Skip to main content

Crate tier_derive

Crate tier_derive 

Source
Expand description

§tier-derive

tier-derive provides #[derive(TierConfig)] and #[derive(TierPatch)] for the tier Rust configuration library.

Use it when you want config metadata to stay next to your serde types instead of being repeated in manual builder code. It derives env names, aliases, examples, validation rules, merge behavior, and secret handling from the same type definitions you already use for deserialization.

It generates structured TierMetadata implementations for nested config structs, newtype wrappers, and serde-driven enums, and it can derive typed sparse patch structs for CLI and last-layer overrides.

Supported metadata includes:

  • field attributes such as secret, env, doc, example, deprecated, merge, and leaf
  • declared validation such as non_empty, numeric and length bounds, one_of, hostname/IP/socket/path rules, and cross-field checks
  • serde-aware naming and shape rules including rename, rename_all, rename_all_fields, alias, default, tagging, skip, and flatten
  • automatic tier::Secret<T> detection
  • typed patch mapping through path, path_expr, and nested

Most users should depend on tier with the derive feature enabled and use the re-exported tier::TierConfig derive macro.

Derive Macros§

TierConfig
Derives tier::TierMetadata for nested configuration structs.
TierPatch
Derives tier::TierPatch for typed sparse override structs.