feat(fs): extract fs::like internal module
This commit is contained in:
parent
483d274e5b
commit
9c76ddc3e1
2 changed files with 16 additions and 9 deletions
12
src/fs/like.rs
Normal file
12
src/fs/like.rs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
use super::Result;
|
||||||
|
|
||||||
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
|
pub trait FileSystemLike {
|
||||||
|
fn base(&self) -> &Path;
|
||||||
|
fn path_of(&self, path: PathBuf) -> Result<PathBuf>;
|
||||||
|
fn file_write(&self, path: &Path, contents: &str) -> Result<()>;
|
||||||
|
fn file_read_to_string(&self, path: &Path) -> Result<String>;
|
||||||
|
fn path_exists(&self, path: &Path) -> Result<bool>;
|
||||||
|
fn path_is_file(&self, path: &Path) -> Result<bool>;
|
||||||
|
}
|
|
@ -1,7 +1,10 @@
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use derive_more::From;
|
use derive_more::From;
|
||||||
|
|
||||||
|
use crate::fs::like::FileSystemLike;
|
||||||
|
|
||||||
|
mod like;
|
||||||
mod real;
|
mod real;
|
||||||
mod temp;
|
mod temp;
|
||||||
|
|
||||||
|
@ -40,11 +43,3 @@ impl std::ops::Deref for FileSystem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub trait FileSystemLike {
|
|
||||||
fn base(&self) -> &Path;
|
|
||||||
fn path_of(&self, path: PathBuf) -> Result<PathBuf>;
|
|
||||||
fn file_write(&self, path: &Path, contents: &str) -> Result<()>;
|
|
||||||
fn file_read_to_string(&self, path: &Path) -> Result<String>;
|
|
||||||
fn path_exists(&self, path: &Path) -> Result<bool>;
|
|
||||||
fn path_is_file(&self, path: &Path) -> Result<bool>;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue