| 1 | use formatxrust-analyzer cargo formatx 0.2.4 crate/::formatxrust-analyzer cargo formatx 0.2.4 macros/formatx!; |
| 2 | |
| 3 | fn messagerust-analyzer cargo formatx 0.2.4 message().(language: &str, name: &str, number: i32) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { |
| 4 | let s = match language { |
| 5 | "french" => "Bonjour {}, le nombre est {}", |
| 6 | "spanish" => "Hola {}, el numero es {}", |
| 7 | _ => "Hi {}, the number is {}", |
| 8 | }; |
| 9 | formatxrust-analyzer cargo formatx 0.2.4 macros/formatx!!(s, name, number).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().() |
| 10 | } |
| 11 | |
| 12 | fn mainrust-analyzer cargo formatx 0.2.4 main().() { |
| 13 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{}", messagerust-analyzer cargo formatx 0.2.4 message().("french", "Léa", 1)); |
| 14 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{}", messagerust-analyzer cargo formatx 0.2.4 message().("spanish", "Sofia", 2)); |
| 15 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{}", messagerust-analyzer cargo formatx 0.2.4 message().("english", "Ashley", 3)); |
| 16 | } |