#[derive(Debug)]
struct Point<T> {
x: T,
y: T,
}
/* impl<T:Copy + Neg<Output = T>> Point<T> {
fn clock_wise(&self) -> Point<T> {
let new_x = self.x.clone()
let nex_y = self.y.clone()
Point {
x: -new_y,
y: new_x
}
}
fn counter_clockwise(&self) -> Point<T> {
let new_x = self.x.clone()
let nex_y = self.y.clone()
Point {
x: new_y,
y: -new_x
}
}
}
*/
/* impl <T:Copy + Neg<Output = T>> Point<T> {
type Output = Point<T>;
#[inline]
fn neg(self) -> Point<T> {
Point::new(-self.x, -self.y)
}
} */ ```
#Help with Rust | Struct & Implementations
1 messages · Page 1 of 1 (latest)
good luck 😄
?
I am more beginner than you with Rust 😄 🤷♂️