Skip to content

Commit addb9e1

Browse files
authored
Update src/ch04-03-slices.md for formatting
1 parent 66ef2b6 commit addb9e1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/ch04-03-slices.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ slices, to understand the problem that slices will solve:
1616
fn first_word(s: &String) -> ?
1717
```
1818

19-
The first_word function has a &String as a parameter. We don’t need ownership, so this is fine.
20-
(In idiomatic Rust, functions do not take ownership of their arguments unless they need to,
21-
and the reasons for that will become clear as we keep going!)
22-
But what should we return? We don’t really have a way to talk about part of a string.
23-
However, we could return the index of the end of the word, indicated by a space.
24-
Let’s try that, as shown in Listing 4-7.
19+
The `first_word` function has a `&String` as a parameter. We don’t need
20+
ownership, so this is fine. (In idiomatic Rust, functions do not take ownership
21+
of their arguments unless they need to, and the reasons for that will become
22+
clear as we keep going!) But what should we return? We don’t really have a way
23+
to talk about part of a string. However, we could return the index of the end of
24+
the word, indicated by a space. Let’s try that, as shown in Listing 4-7.
2525

2626
<Listing number="4-7" file-name="src/main.rs" caption="The `first_word` function that returns a byte index value into the `String` parameter">
2727

0 commit comments

Comments
 (0)