error_label 0.0.1

Low-cardinality label for errors.
Documentation
  • Coverage
  • 100%
    6 out of 6 items documented4 out of 6 items with examples
  • Size
  • Source code size: 280.44 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.78 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 44s Average build duration of successful builds.
  • all releases: 44s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • martintmk

Error Label

crate.io docs.rs MSRV CI Coverage License

Low-cardinality label for errors, useful for metrics and logging.

ErrorLabel wraps a Cow<'static, str> to hold either a static string literal or a heap-allocated String. It is intended for use as a metric tag value or structured log field and should always be chosen from a small, bounded set of values.

Quick Start

use error_label::ErrorLabel;

// From a static string
let label: ErrorLabel = "timeout".into();
assert_eq!(label, "timeout");

// Dotted chain from parts
let label = ErrorLabel::from_parts(["http", "client", "timeout"]);
assert_eq!(label, "http.client.timeout");