use autometrics::autometrics; use std::io; // general purpose `Result`, part of the std prelude. // notice both `Ok` and `Err` generic type arguments are explicitly provided #[autometrics] fn issue_121_a() -> Result { Ok("a") } // specialized `Result` which is part of std but not part of the std prelude. // notice there is only an explicit `Ok` type in the generic args, the `Err` generic argument // is type-defined #[autometrics] fn issue_121_b() -> io::Result { Ok("b") } // specialized `Result` which is part of a foreign crate // notice there is only an explicit `Ok` type in the generic args, the `Err` generic argument // is type-defined in the foreign crate #[autometrics] fn issue_121_c() -> ::http::Result { // CODE STYLE: please keep return formatted this way (with the leading `::`) Ok("c") } // Result where both `Ok` and `Error` are `impl` types #[autometrics] fn issue_121_d() -> Result { if true { Ok("d") } else { Err(io::Error::new(io::ErrorKind::Other, "issue 121d")) } } fn main() { // we need to handle all four code generation cases issue_121_a().unwrap(); issue_121_b().unwrap(); issue_121_c().unwrap(); issue_121_d().unwrap(); }