summaryrefslogtreecommitdiffstats
path: root/src/ext_traits
diff options
context:
space:
mode:
authorhybrid <hybrid@hybridlabs.cc>2026-11-11 17:16:48 +0300
committerhybrid <hybrid@hybridlabs.cc>2026-11-11 17:16:48 +0300
commit9dea46b5e66eb54746b251d8950b2367c49be23d (patch)
treefdebf3880f2f25a1351a220e771da84ea32f07e2 /src/ext_traits
parent59e457f7d6267ac2591837085b388d7c15ed2004 (diff)
downloadrust-book-9dea46b5e66eb54746b251d8950b2367c49be23d.tar.gz
rust-book-9dea46b5e66eb54746b251d8950b2367c49be23d.tar.bz2
rust-book-9dea46b5e66eb54746b251d8950b2367c49be23d.zip
add: supertraits, ext_traits, pancakes, hello, hello_macromain
Diffstat (limited to '')
-rw-r--r--src/ext_traits/Cargo.toml6
-rw-r--r--src/ext_traits/src/main.rs14
2 files changed, 20 insertions, 0 deletions
diff --git a/src/ext_traits/Cargo.toml b/src/ext_traits/Cargo.toml
new file mode 100644
index 0000000..49354b6
--- /dev/null
+++ b/src/ext_traits/Cargo.toml
@@ -0,0 +1,6 @@
+[package]
+name = "ext_traits"
+version = "0.1.0"
+edition = "2024"
+
+[dependencies]
diff --git a/src/ext_traits/src/main.rs b/src/ext_traits/src/main.rs
new file mode 100644
index 0000000..f5d8886
--- /dev/null
+++ b/src/ext_traits/src/main.rs
@@ -0,0 +1,14 @@
+use std::fmt;
+
+struct Wrapper(Vec<String>);
+
+impl fmt::Display for Wrapper {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ write!(f, "[{}]", self.0.join(", "))
+ }
+}
+
+fn main() {
+ let w = Wrapper(vec![String::from("hello"), String::from("world")]);
+ println!("w = {w}");
+}