pub struct FileSystemPersistence { /* private fields */ }Expand description
File system based persistence
Implementations§
Source§impl FileSystemPersistence
impl FileSystemPersistence
Sourcepub fn save_active_profile(&self, name: &str) -> Result<(), PersistenceError>
pub fn save_active_profile(&self, name: &str) -> Result<(), PersistenceError>
Save the active profile name
Sourcepub fn load_active_profile(&self) -> Result<Option<String>, PersistenceError>
pub fn load_active_profile(&self) -> Result<Option<String>, PersistenceError>
Load the active profile name
Sourcepub fn with_default_location() -> Result<Self, PersistenceError>
pub fn with_default_location() -> Result<Self, PersistenceError>
Create a new file system persistence with the default storage location
The default storage location is projects/ricecoder/config/keybinds/
This function will create the directory if it doesn’t exist.
Sourcepub fn config_dir(&self) -> &Path
pub fn config_dir(&self) -> &Path
Get the config directory path
Trait Implementations§
Source§impl KeybindPersistence for FileSystemPersistence
impl KeybindPersistence for FileSystemPersistence
Source§fn save_profile(&self, profile: &Profile) -> Result<(), PersistenceError>
fn save_profile(&self, profile: &Profile) -> Result<(), PersistenceError>
Save a profile to storage
Source§fn load_profile(&self, name: &str) -> Result<Profile, PersistenceError>
fn load_profile(&self, name: &str) -> Result<Profile, PersistenceError>
Load a profile from storage
Source§fn delete_profile(&self, name: &str) -> Result<(), PersistenceError>
fn delete_profile(&self, name: &str) -> Result<(), PersistenceError>
Delete a profile from storage
Source§fn list_profiles(&self) -> Result<Vec<String>, PersistenceError>
fn list_profiles(&self) -> Result<Vec<String>, PersistenceError>
List all saved profiles
Auto Trait Implementations§
impl Freeze for FileSystemPersistence
impl RefUnwindSafe for FileSystemPersistence
impl Send for FileSystemPersistence
impl Sync for FileSystemPersistence
impl Unpin for FileSystemPersistence
impl UnwindSafe for FileSystemPersistence
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more