Skip to content

Instantly share code, notes, and snippets.

@saghm
Created January 28, 2017 03:35
Show Gist options
  • Save saghm/6d76a01172d964615a06dfb16a3dd4e8 to your computer and use it in GitHub Desktop.
Save saghm/6d76a01172d964615a06dfb16a3dd4e8 to your computer and use it in GitHub Desktop.
#[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