box-o-sand/rustbyexample/types.d/alias.rs

16 lines
285 B
Rust
Raw Normal View History

2023-09-25 00:46:41 +00:00
type NanoSecond = u64;
type Inch = u64;
type U64 = u64;
fn main() {
let nanoseconds: NanoSecond = 5 as U64;
let inches: Inch = 2 as U64;
println!(
"{} nanoseconds + {} inches = {} unit?",
nanoseconds,
inches,
nanoseconds + inches
);
}