Can From trait be processed on return value?
Example:
struct Point {
x: i32,
y: i32,
}
impl From<(i32, i32)> for Point {
fn from(value: (i32, i32)) -> Point {
Point {
x: value.0,
y: value.1,
}
}
}
fn calc_point() -> Point {
(1, 2) // doesn't work
}
fn calc_point2<R: Into<Point>>() -> R {
(1, 2) // doesn't work either
}
fn main() {
let p = calc_point();
}