[−][src]Crate etc
etc
It's time to bundle etc for your awesome project!
use etc::{Etc, FileSystem, Read, Write}; fn main() { // config root path let mut dir = std::env::temp_dir(); dir.push(".etc.io"); // generate `/.etc.io` dir let etc = Etc::new(&dir).unwrap(); let hello = etc.open("hello.md").unwrap(); // input and output assert!(hello.write(b"hello, world!\n").is_ok()); assert_eq!(hello.read().unwrap(), b"hello, world!\n"); // remove hello.md assert!(etc.rm("hello.md").is_ok()); // hello.md has been removed let mut hello_md = dir.clone(); hello_md.push("hello.md"); assert!(!hello_md.exists()); // remove all assert!(etc.drain().is_ok()); assert!(!dir.exists()); }
LICENSE
MIT
Structs
Etc | contains dir and file |
Enums
Error | etc Error |
Traits
FileSystem | mock file system |
Meta | meta data |
Read | io read |
Write | io write |