feat: add tests

This commit is contained in:
2024-01-07 18:26:09 +08:00
parent 526dd4172b
commit 7ec4c4a526
15 changed files with 248 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
trait Say {
fn say(&self);
}
struct Dog {}
impl Say for Dog {
fn say(&self) {
println!("Wangwang!");
}
}
fn do_say(s: Box<dyn Say>) {
s.say();
}
fn main() {
let dog = Dog {};
do_say(Box::new(dog));
}