Better chat settings management

This commit is contained in:
Clément Renault
2025-05-21 21:06:11 +02:00
parent 72d4998dce
commit fcc0d43a62
3 changed files with 95 additions and 45 deletions

View File

@ -123,6 +123,15 @@ impl<T> Setting<T> {
*self = new;
true
}
#[track_caller]
pub fn unwrap(self) -> T {
match self {
Setting::Set(value) => value,
Setting::Reset => panic!("Setting::Reset unwrapped"),
Setting::NotSet => panic!("Setting::NotSet unwrapped"),
}
}
}
impl<T: Serialize> Serialize for Setting<T> {