Here is what I have so far:
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct Float2 {
pub x: f32,
pub y: f32,
}
impl Add for Float2 {
type Output = Float2;
fn add (self, rhs: Float2) -> Float2 {
Float2 {
x: self.x + rhs.x,
y: self.y + rhs.y,
}
}
}
This allows Float2 + Float2.
Now, I would also like to implement Float2 + f32, returning Float2, by adding the scalar to both the x & y components.
Is this possible?