Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::ops::Sub;
- struct Foo {
- value: i32
- }
- trait MuhTrait {
- fn traitfn(self, other: Self) -> Self;
- }
- impl MuhTrait for Foo {
- fn traitfn(self, other: Self) -> Self {
- other.value - self.value
- }
- }
- impl<T> Sub<T> for T where T: MuhTrait {
- fn sub(self, other: T) -> T {
- other.traitfn(self)
- }
- }
- fn main() {
- println!("Hello, world!");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement