Hi there.
use std::fmt;
fn main() {
let intro = Rustacean{name: "Yassine", pronouns: &Pronouns::HeHim, distro: "NixOS/Arch"};
println!("{intro}");
}
#[allow(dead_code)]
struct Rustacean<'a> {
name: &'a str,
pronouns: &'a Pronouns<'a>,
distro: &'a str,
}
#[allow(dead_code)]
enum Pronouns<'a> {
HeHim,
SheHer,
TheyThem,
ItIts,
Other(&'a str),
}
impl fmt::Display for Rustacean<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "Hi! I'm {}, and I use {} BTW!", self.name, self.distro)
}
}