mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
libs/userprefs
This commit is contained in:
parent
c43fd370ee
commit
508476a085
1 changed files with 9 additions and 20 deletions
|
|
@ -1,8 +1,9 @@
|
|||
use bincode::error::{DecodeError, EncodeError};
|
||||
use pddb::Pddb;
|
||||
use std::io::Read;
|
||||
use std::io::Write;
|
||||
|
||||
use bincode::error::{DecodeError, EncodeError};
|
||||
use pddb::Pddb;
|
||||
|
||||
static PREFS_DICT: &str = "UserPrefsDict";
|
||||
|
||||
// Time-related consts
|
||||
|
|
@ -20,21 +21,15 @@ pub enum Error {
|
|||
}
|
||||
|
||||
impl From<std::io::Error> for Error {
|
||||
fn from(err: std::io::Error) -> Self {
|
||||
Self::IoError(err)
|
||||
}
|
||||
fn from(err: std::io::Error) -> Self { Self::IoError(err) }
|
||||
}
|
||||
|
||||
impl From<EncodeError> for Error {
|
||||
fn from(err: EncodeError) -> Self {
|
||||
Self::EncodeError(err)
|
||||
}
|
||||
fn from(err: EncodeError) -> Self { Self::EncodeError(err) }
|
||||
}
|
||||
|
||||
impl From<DecodeError> for Error {
|
||||
fn from(err: DecodeError) -> Self {
|
||||
Self::DecodeError(err)
|
||||
}
|
||||
fn from(err: DecodeError) -> Self { Self::DecodeError(err) }
|
||||
}
|
||||
|
||||
/// UserPrefs defines the set of all the user preference toggles available for Precursor.
|
||||
|
|
@ -62,11 +57,7 @@ pub struct Manager {
|
|||
}
|
||||
|
||||
impl Manager {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
pddb_handle: Pddb::new(),
|
||||
}
|
||||
}
|
||||
pub fn new() -> Self { Self { pddb_handle: Pddb::new() } }
|
||||
|
||||
fn pddb_store_key(&self, key: &str, value: &[u8]) -> Result<(), Error> {
|
||||
match self.pddb_handle.get(
|
||||
|
|
@ -151,7 +142,5 @@ impl Manager {
|
|||
}
|
||||
|
||||
impl Default for Manager {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
fn default() -> Self { Self::new() }
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue