Skip to content
This repository was archived by the owner on Oct 23, 2025. It is now read-only.

Commit fd3fc58

Browse files
committed
Add derive doc test
1 parent 564cef5 commit fd3fc58

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

output_derive/src/lib.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
11
//! Custom derives for `output.rs`
2+
//!
3+
//! # Examples
4+
//!
5+
//! ```rust
6+
//! extern crate output;
7+
//! #[macro_use] extern crate output_derive;
8+
//! #[macro_use] extern crate serde_derive;
9+
//!
10+
//! #[derive(Serialize, RenderOutput)]
11+
//! struct Message {
12+
//! code: i32,
13+
//! message: String,
14+
//! }
15+
//!
16+
//! # fn main() -> Result<(), output::Error> {
17+
//! # use output::human;
18+
//! # let test_target = human::test();
19+
//! let mut out = output::new().add_target(test_target.target());
20+
//! out.print(&Message {
21+
//! code: 42,
22+
//! message: String::from("Derive works"),
23+
//! })?;
24+
//! # assert_eq!(test_target.to_string(), "code: 42\nmessage: Derive works\n\n");
25+
//! # Ok(()) }
26+
//! ```
227
328
#![recursion_limit = "1024"]
429

0 commit comments

Comments
 (0)