mirror of
https://github.com/sunface/rust-by-practice.git
synced 2025-06-23 04:29:41 +00:00
Merge branch 'master' into master
This commit is contained in:
@ -149,6 +149,7 @@ fn main() {
|
||||
/* 填空并修复所有错误 */
|
||||
fn main() {
|
||||
let raw_str = r"Escapes don't work here: \x3F \u{211D}";
|
||||
// 修改上面的行让代码工作
|
||||
assert_eq!(raw_str, "Escapes don't work here: ? ℝ");
|
||||
|
||||
// 如果你希望在字符串中使用双引号,可以使用以下形式
|
||||
@ -254,4 +255,4 @@ fn main() {
|
||||
```
|
||||
|
||||
|
||||
> 你可以在[这里](https://github.com/sunface/rust-by-practice/blob/master/solutions/compound-types/string.md)找到答案(在 solutions 路径下)
|
||||
> 你可以在[这里](https://github.com/sunface/rust-by-practice/blob/master/solutions/compound-types/string.md)找到答案(在 solutions 路径下)
|
||||
|
@ -68,7 +68,7 @@ Rust 的借用检查器使用显式的生命周期标注来确定一个引用的
|
||||
**大家先忽略生命周期消除规则**,让我们看看,函数签名中的生命周期有哪些限制:
|
||||
|
||||
- 需要为每个引用标注上合适的生命周期
|
||||
- 返回值中的引用,它的生命周期要么跟某个引用参数相同,要么是 `'statc`
|
||||
- 返回值中的引用,它的生命周期要么跟某个引用参数相同,要么是 `'static`
|
||||
|
||||
**示例**
|
||||
```rust,editable
|
||||
@ -334,4 +334,4 @@ enum Either<'a> {
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
```
|
||||
```
|
||||
|
@ -24,11 +24,11 @@
|
||||
我们使用 [mdbook](https://rust-lang.github.io/mdBook/) 构建在线练习题,你也可以下载到本地运行:
|
||||
```shell
|
||||
$ cargo install mdbook
|
||||
$ cd rust-by-practice && mdbook serve
|
||||
$ cd rust-by-practice && mdbook serve zh-CN/
|
||||
```
|
||||
在本地win 10或者linux服务器上运行时,应当使用 -n 参数指定mdbook服务所监听的IP地址(-p 参数指定服务监听的端口,不指定则为默认的3000),以win 10本地运行为例:
|
||||
```shell
|
||||
$ mdbook serve -p 8888 -n 127.0.0.1
|
||||
$ mdbook serve -p 8888 -n 127.0.0.1 zh-CN/
|
||||
```
|
||||
## 特性
|
||||
|
||||
|
Reference in New Issue
Block a user