Genius is a fickle beast. Sometimes you have the good fortune to work with a mad genius. Other times you are doomed to work with pure madness. There are also times when it is hard to tell the difference.
struct Human {
name: String,
}
impl Human {
fn new(name: String) -> Self {
Self { name }
}
fn display(&self) {
println!("Name: \n{}", self.name);
}
}
struct Programmer {
human: Human,
title: String,
stack: Vec<String>,
languages: Vec<String>,
}
impl Programmer {
fn new(name: String, title: String, stack: Vec<String>, languages: Vec<String>) -> Self {
Self {
human: Human::new(name),
title,
stack,
languages,
}
}
fn display(&self) {
self.human.display();
println!("{}", "\n");
println!("Title: \n{}", self.title);
println!("{}", "\n");
println!("Stack:");
for technology in &self.stack {
println!("· {}", technology);
}
println!("{}", "\n");
println!("Languages:");
for language in &self.languages {
println!("· {}", language);
}
}
}
fn main() {
let programmer = Programmer::new(
"Muneeb Rabaney".to_string(),
"Snr. Software Engineer".to_string(),
vec![
"Bun".to_string(),
"Node".to_string(),
"React".to_string(),
"DotNet".to_string(),
"Laravel".to_string(),
],
vec![
"C".to_string(),
"C#".to_string(),
"SQL".to_string(),
"PHP".to_string(),
"Bash".to_string(),
"TypeScript".to_string(),
],
);
programmer.display();
}