FileSystemPersistence

Struct FileSystemPersistence 

Source
pub struct FileSystemPersistence { /* private fields */ }
Expand description

File system based persistence

Implementations§

Source§

impl FileSystemPersistence

Source

pub fn new(config_dir: impl AsRef<Path>) -> Result<Self, PersistenceError>

Create a new file system persistence with the given config directory

Source§

impl FileSystemPersistence

Source

pub fn save_active_profile(&self, name: &str) -> Result<(), PersistenceError>

Save the active profile name

Source

pub fn load_active_profile(&self) -> Result<Option<String>, PersistenceError>

Load the active profile name

Source

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.

Source

pub fn config_dir(&self) -> &Path

Get the config directory path

Trait Implementations§

Source§

impl KeybindPersistence for FileSystemPersistence

Source§

fn save_profile(&self, profile: &Profile) -> Result<(), PersistenceError>

Save a profile to storage
Source§

fn load_profile(&self, name: &str) -> Result<Profile, PersistenceError>

Load a profile from storage
Source§

fn delete_profile(&self, name: &str) -> Result<(), PersistenceError>

Delete a profile from storage
Source§

fn list_profiles(&self) -> Result<Vec<String>, PersistenceError>

List all saved profiles

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.