Updated 'src/advanced_features/adv_types.md'.

This commit is contained in:
Hector PENG
2026-04-24 16:18:50 +08:00
parent 699eacb46f
commit 828fe1ec2a
4 changed files with 82 additions and 86 deletions

View File

@@ -1,4 +1,6 @@
fn main() {
let s1: str = "致以问候!";
let s2: str = "最近过得怎么样?";
let s1: &str = "致以问候!";
let s2: &str = "最近过得怎么样?";
println! ("{}, {}", s1.len(), s2.len());
}

View File

@@ -1,7 +1,10 @@
fn main() {
print! ("永永 ");
loop {
let res = loop {
print! ("远远 ");
}
break
};
println! ("{res:?}");
}

View File

@@ -5,16 +5,4 @@ fn main() {
let y: Kilometers = 5;
assert_eq! (x, y);
type Thunk = Box<dyn Fn() + Send + 'static>;
let f: Thunk = Box::new(|| println! (""));
fn takes_long_type(f: Thunk) {
// --跳过代码--
}
fn returns_long_type() -> Thunk {
// --跳过代码--
}
}