mirror of
https://github.com/rust-lang-cn/book-cn.git
synced 2025-01-25 00:18:46 +08:00
Ignore partial code blocks, unindent them
This commit is contained in:
parent
f2d21dcbd1
commit
deb9e466bc
@ -36,7 +36,7 @@ fn first_word(s: &String) -> usize {
|
|||||||
|
|
||||||
Let’s break that down a bit:
|
Let’s break that down a bit:
|
||||||
|
|
||||||
```rust
|
```rust,ignore
|
||||||
let bytes = s.as_bytes();
|
let bytes = s.as_bytes();
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ Since we need to go through the String element by element and
|
|||||||
check if a value is a space, we will convert our String to an
|
check if a value is a space, we will convert our String to an
|
||||||
array of bytes using the `.as_bytes()` method.
|
array of bytes using the `.as_bytes()` method.
|
||||||
|
|
||||||
```rust
|
```rust,ignore
|
||||||
for (i, &byte) in bytes.iter().enumerate() {
|
for (i, &byte) in bytes.iter().enumerate() {
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ Since it’s a tuple, we can use patterns, just like elsewhere in Rust.
|
|||||||
So we match against the tuple with i for the index and &byte for
|
So we match against the tuple with i for the index and &byte for
|
||||||
the byte itself.
|
the byte itself.
|
||||||
|
|
||||||
```rust
|
```rust,ignore
|
||||||
if byte == 32 {
|
if byte == 32 {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user