Last active
November 10, 2017 14:30
-
-
Save Kerollmops/4b17eddfdaadfe8e43c912cd029fd5fa to your computer and use it in GitHub Desktop.
Little hack to display default values in the doc. (don't forget to `cargo test --doc`)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Debug, PartialEq, Eq)] | |
pub struct Aaa { | |
pub field1: usize, | |
pub field2: i32, | |
} | |
impl Default for Aaa { | |
/// ``` | |
/// # use aaa::Aaa; | |
/// # let a = | |
/// Aaa { | |
/// field1: 3, | |
/// field2: 5, | |
/// } | |
/// # ; | |
/// # assert_eq!(a, Aaa::default()); | |
/// ``` | |
fn default() -> Self { | |
Self { | |
field1: 3, | |
field2: 5, | |
} | |
} | |
} |
Author
Kerollmops
commented
Nov 9, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment