mirror of https://github.com/KaiserY/trpl-zh-cn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
237 B
13 lines
237 B
3 years ago
|
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))
|
||
|
}
|
||
|
}
|