description 0.2.0

like Display, but 'static
Documentation
  • Coverage
  • 33.33%
    2 out of 6 items documented2 out of 6 items with examples
  • Size
  • Source code size: 6.95 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 245.35 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • adryzz/description
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • adryzz

derive(Description)

This library provides a trait and derive macro that is like std::fmt::Display, but using compile-time strings.

The library is fully no_std and no_alloc, and is meant to provide user-facing text for enum-like status messages without code bloat.

[dependencies]
description = "0.1.0"

Example

use description::Description;

#[derive(Description)]
enum ChargerStatus {
    #[description("Charger connected!")]
    Connected,

    #[description("Charger disconnected!")]
    Disconnected,
}

fn main() {
    let charger = ChargerStatus::Connected;

    println!("Charger notification: {}", charger.description());
}