Registry / utility / displaydoc

displaydoc

JSON →
library0.2.6rscratesunverified

A derive macro for implementing the Display trait via a doc comment and string interpolation

# Cargo.toml [dependencies] displaydoc = "0.2.6"
INSTALL
IMPORT
SIG · DISPLAYDOC
D
displaydoc
utilityrustv0.2.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Display
use displaydoc::Display;

Derive the Display trait using a doc comment

use displaydoc::Display; #[derive(Display)] #[displaydoc("Error: {}", self.0)] struct MyError(String); fn main() { let err = MyError("something went wrong".to_string()); println!("{}", err); }
Debug
Known issues
gotchaRequires Rust 1.56+ for const generics support in some cases.
fix
Update your Rust toolchain to at least 1.56.
affects: >=0.2.0
Upgrade
Version history
0.2.6latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
displaydoc — cargo add displaydoc · libregistry