Skip to content

Commit 18ba75c

Browse files
F001Naupio Z.Y. Huang
authored andcommitted
空结构体语法更新 (#204)
目前允许结构体大括号内为空
1 parent 3093e13 commit 18ba75c

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

07-type/07-02-compound-types.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,14 @@ struct D;
6060

6161
不过到目前为止,空结构体后面不能加大括号,这么写会编译错误:
6262

63-
补充: 注意,最新的nightly版本已经允许这么写编译通过了
63+
补充: 注意,1.9 nightly版本已经允许这么写编译通过了
6464

6565
```rust
6666
struct C {
6767

6868
}
6969
```
7070

71-
不过也有人提出来,这样的写法应该编译通过:https://github.com/rust-lang/rfcs/pull/1506
72-
7371
### 实现结构体 impl
7472

7573
Rust没有继承,它和Golang不约而同的选择了trait(Golang叫Interface)作为其实现多态的基础。当然了,我们要想对一个结构体写一些专门的成员函数应该怎么写呢?

0 commit comments

Comments
 (0)