Better chat settings management

This commit is contained in:
Clément Renault 2025-05-21 21:06:11 +02:00
parent afb43d266e
commit 7929872091
No known key found for this signature in database
GPG key ID: F250A4C4E3AE5F5F
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> {