面试题答案
一键面试struct MyStruct {
value: i32,
}
impl std::ops::Neg for MyStruct {
type Output = MyStruct;
fn neg(self) -> Self::Output {
MyStruct { value: -self.value }
}
}
struct MyStruct {
value: i32,
}
impl std::ops::Neg for MyStruct {
type Output = MyStruct;
fn neg(self) -> Self::Output {
MyStruct { value: -self.value }
}
}