1 #[cfg(test)] 2 mod tests { 3 #[test] it_works()4 fn it_works() { 5 assert_eq!(2 + 2, 4); 6 } 7 } 8 9 #[derive(Debug)] 10 pub struct Foo { 11 s: &'static str, 12 i: &'static str 13 } 14 15 impl Foo { new(s: &'static str) -> Foo16 pub fn new(s: &'static str) -> Foo { 17 Foo{s: s, i: "bar"} 18 } 19 } 20 answer() -> i3221pub fn answer() -> i32 { 22 42 23 }