1 #[cfg(feature = "with_proc_macro")] 2 use rustdoc_proc_macro::make_answer; 3 4 #[cfg(feature = "with_proc_macro")] 5 make_answer!(); 6 7 #[cfg(feature = "with_build_script")] 8 pub const CONST: &str = env!("CONST"); 9 10 /// The answer to the ultimate question 11 /// ``` 12 /// fn answer() -> u32 { 42 } 13 /// assert_eq!(answer(), 42); 14 /// ``` 15 #[cfg(not(feature = "with_proc_macro"))] answer() -> u3216pub fn answer() -> u32 { 17 42 18 } 19 20 #[cfg(test)] 21 mod test { 22 use super::*; 23 24 #[test] test_answer()25 fn test_answer() { 26 assert_eq!(answer(), 42); 27 } 28 } 29