[][src]Crate etc

etc

etc crate doc dependency status downloads LICENSE

It's time to bundle etc for your awesome project!

use etc::{Etc, FileSystem, Read, Write};

fn main() {
    // config root path
    let mut dir = dirs::home_dir().unwrap();
    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

Macros

parameter_types

Macro for easily creating a new implementation of the Get trait. Use similarly to how you would declare a const:

Structs

Etc

The main struct in etc

Source

contains dir and file

Enums

Error

etc Error

Traits

FileSystem

mock file system

Meta

meta data

Read

io read

Write

io write