This is an automated archive made by the Lemmit Bot.

The original was posted on /r/rust by /u/crevetor on 2024-11-04 00:46:08+00:00.


Basically why doesn’t this work ? The compilation error doesn’t help me much.

enum Direction {
    Left,
    Right
}

impl Into for Direction {
    fn into(self) -> f32 {
        match self {
            Direction::Left => 1.,
            Direction::Right => -1.,
        }
    }
}

fn main() {
    let dir = Direction::Left;
    // Also tried calling dir.into() with no success here
    let res: f32 = 10.*dir;
}