Created
July 18, 2014 01:05
-
-
Save bjeanes/ae49d0d7949ac48f9a64 to your computer and use it in GitHub Desktop.
This file contains 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
use std::default::Default; | |
#[deriving(Show)] | |
struct Person { | |
age: u8 | |
} | |
impl Default for Person { | |
fn default() -> Person { Person { age: 0 } } | |
} | |
fn main() { | |
// yes! | |
let p: Person = Default::default(); | |
println!("{}", p) | |
// yes! | |
println!("{}", Person { ..Default::default() }) | |
// no? | |
//println!("{}", Person::default()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment