synd_stdx/fs/
fsimpl.rs

1use std::{fs::File, io, path::Path};
2
3#[derive(Debug, Clone, Default)]
4pub struct FileSystem {}
5
6impl FileSystem {
7    pub fn new() -> Self {
8        Self {}
9    }
10}
11
12impl super::FileSystem for FileSystem {
13    fn create_dir_all<P: AsRef<Path>>(&self, path: P) -> std::io::Result<()> {
14        std::fs::create_dir_all(path)
15    }
16
17    fn create_file<P: AsRef<Path>>(&self, path: P) -> io::Result<File> {
18        std::fs::File::create(path)
19    }
20
21    fn open_file<P: AsRef<Path>>(&self, path: P) -> io::Result<File> {
22        std::fs::File::open(path)
23    }
24
25    fn remove_file<P: AsRef<Path>>(&self, path: P) -> std::io::Result<()> {
26        std::fs::remove_file(path)
27    }
28}