1#[derive(Debug)] 2pub struct Foo { 3 foo: String, 4 yes: bool, 5} 6 7impl Foo { 8 pub fn new(foo: String) -> Self { 9 Self { foo, yes: true } 10 } 11 12 pub fn maybe(&self) { 13 if self.yes { 14 println!("{}", self.foo) 15 } 16 } 17}