pub struct SafirStore {
pub store: PersistentStore,
pub headless: bool,
}Expand description
Safir Store (fancy wrapper around reading and writing to a JSON file)
Fields§
§store: PersistentStore§headless: boolImplementations§
Source§impl SafirStore
impl SafirStore
Sourcepub async fn new(config: &SafirConfig) -> Result<Self>
pub async fn new(config: &SafirConfig) -> Result<Self>
Initialises the Safirstore if not already initialised
Sourcepub fn display_all(&self)
pub fn display_all(&self)
Display all key/values in the store
Trait Implementations§
Source§impl SafirEngine for SafirStore
impl SafirEngine for SafirStore
Source§fn add_entry<'life0, 'async_trait>(
&'life0 mut self,
key: String,
value: String,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_entry<'life0, 'async_trait>(
&'life0 mut self,
key: String,
value: String,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Add an entry to the store and write it out to disk
Source§fn get_entry<'life0, 'async_trait>(
&'life0 self,
key: String,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_entry<'life0, 'async_trait>(
&'life0 self,
key: String,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get an entry form the store by loading it from disk and displaying it
Source§fn remove_entry<'life0, 'async_trait>(
&'life0 mut self,
keys: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn remove_entry<'life0, 'async_trait>(
&'life0 mut self,
keys: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Remove a key/value pair from the store and update onto disk
Source§fn set_commands<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
prefix: &'life1 str,
keys: &'life2 Vec<String>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn set_commands<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
prefix: &'life1 str,
keys: &'life2 Vec<String>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Outputs the key/value pair as a command with the prefix
E.g. With a prefix of alias this will display the command as
alias {key}="{value}" with {key} / {value} replaced with their values from the store
Source§fn clear_entries<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn clear_entries<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Clear the the contents of the store and update onto disk
fn to_type(&self) -> &dyn Any
Auto Trait Implementations§
impl Freeze for SafirStore
impl RefUnwindSafe for SafirStore
impl Send for SafirStore
impl Sync for SafirStore
impl Unpin for SafirStore
impl UnwindSafe for SafirStore
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more