book: add no_run and use statement to strings no-coercion example
This commit is contained in:
parent
49597fcbf2
commit
2b3354cbf8
1 changed files with 3 additions and 1 deletions
|
|
@ -54,7 +54,9 @@ instead of `&str`. For example, [`TcpStream::connect`][connect] has a parameter
|
|||
of type `ToSocketAddrs`. A `&str` is okay but a `String` must be explicitly
|
||||
converted using `&*`.
|
||||
|
||||
```rust
|
||||
```rust,no_run
|
||||
use std::net::TcpStream;
|
||||
|
||||
TcpStream::connect("192.168.0.1:3000"); // &str parameter
|
||||
|
||||
let addr_string = "192.168.0.1:3000".to_string();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue