kxio 1.1.2

Provides injectable Filesystem and Network resources to make code more testable
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use super::Result;

use std::path::{Path, PathBuf};

pub trait FileSystemLike {
    fn base(&self) -> &Path;

    fn dir_create(&self, path: &Path) -> Result<()>;
    fn dir_create_all(&self, path: &Path) -> Result<()>;

    fn file_read_to_string(&self, path: &Path) -> Result<String>;
    fn file_write(&self, path: &Path, contents: &str) -> Result<()>;

    fn path_exists(&self, path: &Path) -> Result<bool>;
    fn path_is_dir(&self, path: &Path) -> Result<bool>;
    fn path_is_file(&self, path: &Path) -> Result<bool>;
    fn path_of(&self, path: PathBuf) -> Result<PathBuf>;
}