mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
11 lines
199 B
Rust
11 lines
199 B
Rust
|
#![allow(unused_must_use)]
|
||
|
|
||
|
use std::convert::TryFrom;
|
||
|
use std::num::TryFromIntError;
|
||
|
|
||
|
fn main() {
|
||
|
let x: u32 = 125;
|
||
|
let y: Result<u8, TryFromIntError> = u8::try_from(x);
|
||
|
y == Ok(125);
|
||
|
}
|