sparse_bitfield/change.rs
1/// Determine wether the `bitfield.set()` method changed the underlying value.
2#[derive(Debug, PartialEq)]
3pub enum Change {
4 /// The value was changed. Equal to `true` in `mafintosh/sparse-bitfield`.
5 Changed,
6 /// The value was not changed. Equal to `false` in
7 /// `mafintosh/sparse-bitfield`.
8 Unchanged,
9}
10
11impl Change {
12 /// Returns `true` if the result is `Changed`.
13 #[inline]
14 pub fn is_changed(&self) -> bool {
15 *self == Change::Changed
16 }
17
18 /// Returns `true` if the result is `Unchanged`.
19 #[inline]
20 pub fn is_unchanged(&self) -> bool {
21 !self.is_changed()
22 }
23}