You could consider actually implementing From when you define a from method:
impl From<(i32, u32)> for Fixed {
fn from((integer, decimal): (i32, u32)) -> Fixed {
Fixed {
integer,
decimal,
}
}
}
I think it's more clear (otherwise use 'new'), but what is more, you can have "overloading", e.g.
impl From<f64> for A {
fn from(val: f64) -> A {
Fixed {
integer: val.round() as i32,
decimal: (val * (std::u32::MAX as f64)).round() as u32,
}
}
}
fn main() {
let a1 = Fixed::from((1, 0));
let a2 = Fixed::from(1.0);
}