use std::fmt::Debug;
use crate::{
CopyOptions,
CopyOutcome,
CreateDirOptions,
DeleteOptions,
DirectoryStream,
FileMetadata,
FileReader,
FileSystemCapabilities,
FileSystemMetadata,
FileWriter,
FsPath,
FsResult,
ListOptions,
ManagedTempResourceFactory,
ReadOptions,
RenameOptions,
TempResourceFactory,
WriteOptions,
};
pub trait FileSystem: Debug + Send + Sync {
fn metadata(&self) -> FileSystemMetadata;
#[inline]
fn capabilities(&self) -> FileSystemCapabilities {
self.metadata().capabilities
}
#[inline]
fn temp_resource_factory(&self) -> &dyn TempResourceFactory {
ManagedTempResourceFactory::shared()
}
fn path_metadata(&self, path: &FsPath) -> FsResult<FileMetadata>;
fn exists(&self, path: &FsPath) -> FsResult<bool>;
fn list(&self, path: &FsPath, options: &ListOptions) -> FsResult<Box<dyn DirectoryStream>>;
fn open_reader(&self, path: &FsPath, options: &ReadOptions) -> FsResult<Box<dyn FileReader>>;
fn open_writer(&self, path: &FsPath, options: &WriteOptions) -> FsResult<Box<dyn FileWriter>>;
fn create_dir(&self, path: &FsPath, options: &CreateDirOptions) -> FsResult<()>;
fn delete(&self, path: &FsPath, options: &DeleteOptions) -> FsResult<()>;
fn rename(&self, from: &FsPath, to: &FsPath, options: &RenameOptions) -> FsResult<()>;
fn copy(&self, from: &FsPath, to: &FsPath, options: &CopyOptions) -> FsResult<CopyOutcome>;
}