mirror of
https://github.com/rust-lang/book.git
synced 2026-11-30 19:34:32 -06:00
Fix the build
This commit is contained in:
@@ -52,6 +52,11 @@ DIAGRAM GOES HERE of a &String pointing at a String, with (ptr, len, capacity)
|
||||
Let’s take a closer look at the function call here:
|
||||
|
||||
```rust
|
||||
# fn calculate_length(s: &String) -> usize {
|
||||
# let length = s.len();
|
||||
#
|
||||
# length
|
||||
# }
|
||||
let s1 = String::from("hello");
|
||||
|
||||
let len = calculate_length(&s1);
|
||||
|
||||
Reference in New Issue
Block a user