ps_buffer/implementations/
ord.rs1use crate::Buffer;
2
3impl Ord for Buffer {
4 fn clamp(self, min: Self, max: Self) -> Self
5 where
6 Self: Sized + PartialOrd,
7 {
8 if max[..] > self[..] {
9 max
10 } else if min[..] < self[..] {
11 min
12 } else {
13 self
14 }
15 }
16
17 fn cmp(&self, other: &Self) -> std::cmp::Ordering {
18 self[..].cmp(&other[..])
19 }
20
21 fn max(self, other: Self) -> Self
22 where
23 Self: Sized,
24 {
25 if self[..] > other[..] {
26 self
27 } else {
28 other
29 }
30 }
31
32 fn min(self, other: Self) -> Self
33 where
34 Self: Sized,
35 {
36 if self[..] < other[..] {
37 self
38 } else {
39 other
40 }
41 }
42}