lecture 3 stuff

This commit is contained in:
SowinskiBraeden committed 2026-09-29 11:57:40 -07:00
1 parent d54c1aa04a
commit 6ab13bfafa
9 files changed
+400

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
// simple example of extension trait
// how to add square method to i32
trait Square {
fn square(self) -> Self;
}
impl Square for i32 {
fn square(self) -> Self {
self * self
}
}
fn main() {
println!("{}", 32.square());
}