use std::fmt;
#[derive(Debug)]
struct User {
name: String,
username: String,
bio: String,
works_at: String,
programming_languages: String,
interested_in: String,
}
impl User {
fn new() -> Self {
User {
name: "Artyem".to_string(),
username: "wlcmtunknwndth".to_string(),
bio: "Currently learning rust for highload purposes".to_string(),
works_at: "VK AI".to_string(),
programming_languages: "go, rust, python".to_string(),
interested_in: "backend, ml, ds".to_string(),
}
}
}
impl fmt::Display for User {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "User {{ name: {}, username: {}, bio: {}, works_at: {}, programming_languages: {}, interested_in: {} }}",
self.name, self.username, self.bio, self.works_at, self.programming_languages, self.interested_in)
}
}
fn main() {
let user = User::new();
println!("{}", user);
}
Highlights
- Pro
Pinned Loading
Something went wrong, please refresh the page to try again.
If the problem persists, check the GitHub status page or contact support.
If the problem persists, check the GitHub status page or contact support.
