pub struct JsonStorage { /* private fields */ }Expand description
JSON file-based storage implementation
Implementations§
Source§impl JsonStorage
impl JsonStorage
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Creates a new JsonStorage pointing to the default OS data directory.
The data directory is created automatically if it does not exist.
§Errors
Returns an error if the OS data directory cannot be determined or if the directory cannot be created.
Trait Implementations§
Source§impl Storage for JsonStorage
impl Storage for JsonStorage
Source§fn load(&self) -> Result<Vec<Task>>
fn load(&self) -> Result<Vec<Task>>
Loads tasks from the JSON file.
Automatically migrates tasks without UUIDs by generating and saving them.
Returns an empty list if the file does not exist yet.
Auto Trait Implementations§
impl Freeze for JsonStorage
impl RefUnwindSafe for JsonStorage
impl Send for JsonStorage
impl Sync for JsonStorage
impl Unpin for JsonStorage
impl UnsafeUnpin for JsonStorage
impl UnwindSafe for JsonStorage
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