1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// #![include_doc("../../../README.md", start)]
//! # parse-display
//!
//! [](https://crates.io/crates/parse-display)
//! [](https://docs.rs/parse-display/)
//! [](https://github.com/frozenlib/parse-display/actions)
//!
//! This crate provides derive macro `Display` and `FromStr`.
//! These macros use common helper attributes to specify the format.
//!
//! ## Install
//!
//! Add this to your Cargo.toml:
//!
//! ```toml
//! [dependencies]
//! parse-display = "0.10.0"
//! ```
//!
//! ## Documentation
//!
//! See [`#[derive(Display)]`](https://docs.rs/parse-display/latest/parse_display/derive.Display.html) documentation for details.
//!
//! ## Example
//!
//! ```rust
//! use parse_display::{Display, FromStr};
//!
//! #[derive(Display, FromStr, PartialEq, Debug)]
//! #[display("{a}-{b}")]
//! struct X {
//! a: u32,
//! b: u32,
//! }
//! assert_eq!(X { a:10, b:20 }.to_string(), "10-20");
//! assert_eq!("10-20".parse(), Ok(X { a:10, b:20 }));
//!
//!
//! #[derive(Display, FromStr, PartialEq, Debug)]
//! #[display(style = "snake_case")]
//! enum Y {
//! VarA,
//! VarB,
//! }
//! assert_eq!(Y::VarA.to_string(), "var_a");
//! assert_eq!("var_a".parse(), Ok(Y::VarA));
//! ```
//!
//! ## License
//!
//! This project is dual licensed under Apache-2.0/MIT. See the two LICENSE-\* files for details.
//!
//! ## Contribution
//!
//! Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
// #![include_doc("../../../README.md", end)]