mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
Introduce Setting::some_or_not_set
This commit is contained in:
parent
7a347966da
commit
553440632e
2 changed files with 21 additions and 14 deletions
|
@ -67,6 +67,13 @@ impl<T> Setting<T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn some_or_not_set(option: Option<T>) -> Self {
|
||||
match option {
|
||||
Some(value) => Setting::Set(value),
|
||||
None => Setting::NotSet,
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn as_ref(&self) -> Setting<&T> {
|
||||
match *self {
|
||||
Self::Set(ref value) => Setting::Set(value),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue