mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Update prefs API to return an Option<bool>.
This allows for situations where there is no reasonable default to apply for the pref value e.g. when we are just listing values
This commit is contained in:
parent
cc1eb3f741
commit
a208379f46
7 changed files with 12 additions and 12 deletions
|
@ -41,8 +41,8 @@ fn read_prefs() -> Result<HashMap<String, bool>, ()> {
|
|||
Ok(prefs)
|
||||
}
|
||||
|
||||
pub fn get_pref(name: &str, default: bool) -> bool {
|
||||
*PREFS.lock().unwrap().get(name).unwrap_or(&default)
|
||||
pub fn get_pref(name: &str) -> Option<bool> {
|
||||
PREFS.lock().unwrap().get(name).cloned()
|
||||
}
|
||||
|
||||
pub fn set_pref(name: &str, value: bool) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue