1use crate::Setting;
2
3impl<T> Setting<T>
4where
5 T: Default,
6{
7 pub fn set(&mut self, value: T) {
9 *self = Self::Normal(value);
10 }
11 pub fn reset(&mut self) {
13 *self = Self::Initial;
14 }
15 pub fn unset(&mut self) {
17 *self = Self::Unset;
18 }
19 pub fn unwrap(self) -> T {
21 match self {
22 Self::Initial | Self::Unset => Default::default(),
23 Self::Normal(t) => t,
24 }
25 }
26 pub fn is_default(&self) -> bool {
28 matches!(self, Self::Initial)
29 }
30 pub fn is_none(&self) -> bool {
32 matches!(self, Self::Unset)
33 }
34 pub fn is_some(&self) -> bool {
36 matches!(self, Self::Normal(_))
37 }
38}