diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-07-17 00:11:59 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-07-17 00:11:59 +0800 |
| commit | d31a8181bd4ac80ef678c29e6fab5607628bb76e (patch) | |
| tree | cffa2aa4c82f8ca4be2516737a13060a47612f12 | |
| parent | 3f653ba743d1fb22e662e28ec9532b0adf8e9ba2 (diff) | |
feat(flag): implement Not operator for Flag
| -rw-r--r-- | mingling_picker/src/value.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/mingling_picker/src/value.rs b/mingling_picker/src/value.rs index 7d52442..ee0d6ee 100644 --- a/mingling_picker/src/value.rs +++ b/mingling_picker/src/value.rs @@ -1,6 +1,6 @@ use std::{ fmt::{Debug, Display}, - ops::Deref, + ops::{Deref, Not}, }; /// Parsed result of a boolean-style command-line flag. @@ -132,3 +132,14 @@ impl Deref for Flag { } } } + +impl Not for Flag { + type Output = Flag; + + fn not(self) -> Flag { + match self { + Flag::Active => Flag::Inactive, + Flag::Inactive => Flag::Active, + } + } +} |
