Initial commit

This commit is contained in:
2026-04-14 03:44:59 +02:00
commit a6eb642c76
32 changed files with 589 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
[package]
name = "demo"
version = "0.1.0"
edition = "2024"
[dependencies]
+26
View File
@@ -0,0 +1,26 @@
// Procedural macro
// Derive macro
// #[derive(Debug)]
struct User {
first_name: String,
last_name: String,
email: String,
}
impl std::fmt::Display for User {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{} {}", self.first_name, self.last_name)
}
}
fn main() {
let tim = User {
first_name: "Tim".into(),
last_name: "Huizinga".into(),
email: "tim@huizinga.dev".into(),
};
println!("User: {tim}");
// println!("User: {tim:?}");
}