diff options
| author | gennyble <gen@nyble.dev> | 2026-06-28 00:21:57 -0500 |
|---|---|---|
| committer | gennyble <gen@nyble.dev> | 2026-06-28 00:21:57 -0500 |
| commit | cf15b57af494adea4aba5b54d64c255e8907fa3d (patch) | |
| tree | 5f926170c834be8f059d350f4dd58d5b7128df78 /src | |
| parent | 4c16a6e8c5186f2dffa8bacb21fb3fbde4d5f74f (diff) | |
add deref for Boolean into bool
Diffstat (limited to 'src')
| -rw-r--r-- | src/formula/boolean.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/formula/boolean.rs b/src/formula/boolean.rs index bbef721..5412c4c 100644 --- a/src/formula/boolean.rs +++ b/src/formula/boolean.rs @@ -1,4 +1,4 @@ -use std::str::FromStr; +use std::{ops::Deref, str::FromStr}; use crate::formula::Formula; @@ -19,6 +19,17 @@ impl FromStr for Boolean { } } +impl Deref for Boolean { + type Target = bool; + + fn deref(&self) -> &Self::Target { + match self { + Self::Yes => &true, + Self::No => &false, + } + } +} + pub struct BooleanFormula; impl BooleanFormula { pub fn new() -> Self { |
