Skip to content

Commit da968d2

Browse files
committed
fix test
1 parent 28938f1 commit da968d2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/rust-next/tryfrom-and-tryinto.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,10 @@ arrays is tedious to do manually. With the new traits, it can be done inline
1414
with `.try_into()`:
1515

1616
```rust
17+
use std::convert::TryInto;
18+
# fn main() -> Result<(), Box<dyn std::error::Error>> {
19+
# let slice = &[1, 2, 3, 4][..];
1720
let num = u32::from_be_bytes(slice.try_into()?);
21+
# Ok(())
22+
# }
1823
```

0 commit comments

Comments
 (0)