ferroui_dynamic_data/cache/
sort_optimisations.rs1use std::fmt;
4use std::ops::{BitAnd, BitOr, BitOrAssign};
5
6#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
8pub struct SortOptimisations(u32);
9
10impl SortOptimisations {
11 pub const NONE: Self = Self(0);
13
14 pub const COMPARES_IMMUTABLE_VALUES_ONLY: Self = Self(1);
18
19 pub const IGNORE_EVALUATES: Self = Self(2);
22
23 #[deprecated(note = "This is no longer being used. Use one of the other options instead.")]
25 pub const INSERT_AT_END_THEN_SORT: Self = Self(3);
26
27 pub const fn bits(self) -> u32 {
29 self.0
30 }
31
32 pub const fn has_flag(self, flag: Self) -> bool {
34 self.0 & flag.0 == flag.0
35 }
36}
37
38impl BitOr for SortOptimisations {
39 type Output = Self;
40
41 fn bitor(self, rhs: Self) -> Self {
42 Self(self.0 | rhs.0)
43 }
44}
45
46impl BitOrAssign for SortOptimisations {
47 fn bitor_assign(&mut self, rhs: Self) {
48 self.0 |= rhs.0;
49 }
50}
51
52impl BitAnd for SortOptimisations {
53 type Output = Self;
54
55 fn bitand(self, rhs: Self) -> Self {
56 Self(self.0 & rhs.0)
57 }
58}
59
60impl fmt::Debug for SortOptimisations {
61 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
63 match self.0 {
64 0 => f.write_str("None"),
65 1 => f.write_str("ComparesImmutableValuesOnly"),
66 2 => f.write_str("IgnoreEvaluates"),
67 3 => f.write_str("InsertAtEndThenSort"),
68 other => write!(f, "{other}"),
69 }
70 }
71}