Created
January 28, 2017 03:35
-
-
Save saghm/6d76a01172d964615a06dfb16a3dd4e8 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
#[macro_use] extern crate derive_builder; | |
#[derive(Debug, Default, Builder)] | |
struct SomeOptions { | |
allow_a: Option<bool>, | |
} | |
impl SomeOptions { | |
pub fn allowed(&self) -> bool { | |
self.allow_a | |
} | |
} | |
fn main() { | |
let options = SomeOptions::default().allow_a(true); | |
println!("{:#?}", options); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment