pub struct ActionsFile { /* private fields */ }Expand description
A store file as read: each entry’s JSON, untouched.
Implementations§
Source§impl ActionsFile
impl ActionsFile
Sourcepub fn parse(text: &str) -> Result<ActionsFile>
pub fn parse(text: &str) -> Result<ActionsFile>
Parses the file’s text. Entries that are not objects are refused, as is anything but an array.
Sourcepub fn load(path: &Path) -> Result<ActionsFile>
pub fn load(path: &Path) -> Result<ActionsFile>
Reads a store file; a missing file is an empty list.
Sourcepub fn save(&self, path: &Path) -> Result<()>
pub fn save(&self, path: &Path) -> Result<()>
Writes a store file atomically: a temp file beside it, then a rename, creating its folder if needed. On a failure the temp file is removed and the old file, if any, stays as it was.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn put(&mut self, def: &ActionDef)
pub fn put(&mut self, def: &ActionDef)
Adds an action at the end, or replaces the entry with its id. Only
id, name, shortcut and steps are written; the entry’s other
fields and its key order stay.
Sourcepub fn set_shortcut(&mut self, id: &str, shortcut: Option<String>)
pub fn set_shortcut(&mut self, id: &str, shortcut: Option<String>)
Changes only an action’s shortcut (also for an entry falcon can’t run).
Trait Implementations§
Source§impl Clone for ActionsFile
impl Clone for ActionsFile
Source§fn clone(&self) -> ActionsFile
fn clone(&self) -> ActionsFile
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ActionsFile
impl Debug for ActionsFile
Source§impl Default for ActionsFile
impl Default for ActionsFile
Source§fn default() -> ActionsFile
fn default() -> ActionsFile
Returns the “default value” for a type. Read more
Source§impl PartialEq for ActionsFile
impl PartialEq for ActionsFile
impl StructuralPartialEq for ActionsFile
Auto Trait Implementations§
impl Freeze for ActionsFile
impl RefUnwindSafe for ActionsFile
impl Send for ActionsFile
impl Sync for ActionsFile
impl Unpin for ActionsFile
impl UnsafeUnpin for ActionsFile
impl UnwindSafe for ActionsFile
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().