Skip to content

Commit 95d5e64

Browse files
authored
Merge pull request #46 from kpp/patch-1
Fix example in readme
2 parents 658be9d + 3e54dd2 commit 95d5e64

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ then run `cargo build`.
3636
```rust
3737
extern crate multiaddr;
3838

39-
use multiaddr::{Multiaddr, ToMultiaddr};
39+
use multiaddr::{Multiaddr, multiaddr};
4040

41-
let address = "/ip4/127.0.0.1/udp/1234".parse::<Multiaddr>().unwrap();
42-
// or directly from a string
43-
let other = "/ip4/127.0.0.1".to_multiaddr().unwrap();
41+
let address = "/ip4/127.0.0.1/tcp/1234".parse::<Multiaddr>().unwrap();
42+
// or with a macro
43+
let other = multiaddr!(Ip4([127, 0, 0, 1]), Udp(10500u16), Quic);
4444

45-
assert_eq!(address.to_string(), "/ip4/127.0.0.1/udp/1234");
46-
assert_eq!(other.to_string(), "/ip4/127.0.0.1");
45+
assert_eq!(address.to_string(), "/ip4/127.0.0.1/tcp/1234");
46+
assert_eq!(other.to_string(), "/ip4/127.0.0.1/udp/10500/quic");
4747
```
4848

4949
## Maintainers

0 commit comments

Comments
 (0)