mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2024-11-14 04:41:49 +08:00
13 lines
237 B
Rust
13 lines
237 B
Rust
use std::ops::Add;
|
|
|
|
struct Millimeters(u32);
|
|
struct Meters(u32);
|
|
|
|
impl Add<Meters> for Millimeters {
|
|
type Output = Millimeters;
|
|
|
|
fn add(self, other: Meters) -> Millimeters {
|
|
Millimeters(self.0 + (other.0 * 1000))
|
|
}
|
|
}
|