diff --git a/milli/src/update/settings.rs b/milli/src/update/settings.rs index 41c156676..dee63c726 100644 --- a/milli/src/update/settings.rs +++ b/milli/src/update/settings.rs @@ -28,6 +28,21 @@ impl Default for Setting { } impl Setting { + pub fn set(self) -> Option { + match self { + Self::Set(value) => Some(value), + _ => None, + } + } + + pub const fn as_ref(&self) -> Setting<&T> { + match *self { + Self::Set(ref value) => Setting::Set(value), + Self::Reset => Setting::Reset, + Self::NotSet => Setting::NotSet, + } + } + pub const fn is_not_set(&self) -> bool { matches!(self, Self::NotSet) }