use std::fmt::Debug;
use std::sync::Arc;
use crate::{
FileMetadata,
FileResource,
FileSystem,
FsPath,
FsResult,
};
pub trait TempResource: Debug + Send + Sync {
fn fs(&self) -> Arc<dyn FileSystem>;
fn path(&self) -> &FsPath;
fn resource(&self) -> FileResource {
FileResource::new(self.fs(), self.path().clone())
}
fn exists(&self) -> FsResult<bool> {
self.fs().as_ref().exists(self.path())
}
fn metadata(&self) -> FsResult<FileMetadata> {
self.fs().as_ref().path_metadata(self.path())
}
fn cleanup(self: Box<Self>) -> FsResult<()>;
fn keep(self: Box<Self>) -> FsResult<FsPath>;
}