Crate ephemeral

source ·
Expand description

Ephemeral creates a temporary project on your filesystem at any location of your choice so that you can use it while testing anything that works on a rust project - mainly cargo commands/binaries. It can be used to generate projects of other languages too.

INSTALLATION:

To use this crate, add it to the dev-dependencies since it is used only during testing:

[dev-dependencies]
ephemeral = "0.2"

USAGE:

To create a project:

use ephemeral::{Project, Dir};

fn main() {
    let project = Project::new("tmp")
       .add_dir(Dir::new("tmp/foo").add_file("bar", &vec![101u8]))
       .build();

    project.clear();
}

This will create a new project in a dir called tmp which will contain a dir “foo” which will contain a file bar with e (101u8) written to the file.

Structs

Represents a dir in the filesystem. Accepts a path and contains a vector of files added.
Represents a file stored in the filesystem. Contains the path and the contents in bytes.
Project represents a project created on the file system at any user-defined location defined by the path parameter to the new() function.