Struct dodo::Directory [−][src]
pub struct Directory { /* fields omitted */ }
Storage backed by a folder.
Locking strategy
This storage does not have any entry locking mechanism.
Errors
All files in the folder are considered part of this storage. Thus, any unexpected event (denied permission, interrupted, …) in the folder will result in an error.
It is expected that the folder remains valid as long a the storage exists. Tempering with the folder in any way (deleting it, moving it, removing permissions, …) will result in an error.
Implementations
impl Directory
[src]
impl Directory
[src]pub fn new<P>(path: P) -> Result<Self> where
P: AsRef<Path>,
[src]
P: AsRef<Path>,
Create a new directory storage, or open it if it already exist. Folders are created recursively if needed.
Examples
use dodo::prelude::*; fn main() -> Result<(), Box<dyn std::error::Error>> { let directory = Directory::new(&path)?; Ok(()) }
Errors
This will return an error in the following situations :
- Folders didn’t exists, and storage wasn’t able to create it.
- Path points at a file, not a folder.
- Other IO specific errors (permission denied, invalid path, …).
Trait Implementations
impl Storage for Directory
[src]
impl Storage for Directory
[src]type Read = FileReader
Reader.
type Write = FileWriter
Writer.
type Iterator = Iter
Iterator.
fn new(&mut self) -> Result<(Uuid, Self::Write)>
[src]
fn read(&self, entry: Uuid) -> Result<Self::Read>
[src]
fn write(&mut self, entry: Uuid) -> Result<Self::Write>
[src]
fn overwrite(&mut self, entry: Uuid) -> Result<Self::Write>
[src]
fn delete(&mut self, entry: Uuid) -> Result<bool>
[src]
fn clear(&mut self) -> Result<()>
[src]
fn iter(&self) -> Result<Self::Iterator>
[src]
Auto Trait Implementations
impl RefUnwindSafe for Directory
impl RefUnwindSafe for Directory
impl UnwindSafe for Directory
impl UnwindSafe for Directory