Created
March 27, 2021 09:16
-
-
Save MikuroXina/1fc910411a6f0b83f6bd85c96aa0b491 to your computer and use it in GitHub Desktop.
You can use with `impl` to the type you want.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| trait ChMax: Sized + PartialOrd { | |
| fn ch_max(&mut self, other: Self) { | |
| if *self < other { | |
| *self = other; | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| trait ChMin: Sized + PartialOrd { | |
| fn ch_min(&mut self, other: Self) { | |
| if other < *self { | |
| *self = other; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment