pub trait WritableFolderStore: Send + Sync {
// Required methods
fn write(&self, name: &str, contents: &[u8]) -> Result<(), FolderError>;
fn read(&self, name: &str) -> Result<Vec<u8>, FolderError>;
fn list(&self) -> Result<Vec<String>, FolderError>;
fn remove(&self, name: &str) -> Result<(), FolderError>;
fn is_writable(&self) -> bool;
fn handle(&self) -> String;
}Expand description
Synchronous, thread-safe access to a user-chosen writable folder.
Implementations are Send + Sync so a background thread can read and write
without involving the UI thread. Treat it as a flat store of named files
(directories are not exposed by list).
Required Methods§
Sourcefn write(&self, name: &str, contents: &[u8]) -> Result<(), FolderError>
fn write(&self, name: &str, contents: &[u8]) -> Result<(), FolderError>
Writes (overwriting) the file name with contents.
Sourcefn list(&self) -> Result<Vec<String>, FolderError>
fn list(&self) -> Result<Vec<String>, FolderError>
Lists the immediate child file names (directories excluded).
Sourcefn remove(&self, name: &str) -> Result<(), FolderError>
fn remove(&self, name: &str) -> Result<(), FolderError>
Removes the file name. Succeeds if it is already absent.
Sourcefn is_writable(&self) -> bool
fn is_writable(&self) -> bool
Cheaply probes whether the folder is writable right now (e.g. detects a read-only WebDAV mount that still granted a write permission).
Sourcefn handle(&self) -> String
fn handle(&self) -> String
The durable handle (filesystem path / SAF tree URI) used to reopen this
folder with open_writable_folder on a later run.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".