fs pro

A library to work with files easily

crates.io Crates.io

the is a beta rust version of fs-pro

see the full docs here

Features

Usage

```rust use fs_pro::{Dir, File, Shape, error::Result};

[derive(Shape)]

struct ChildShapedDir { #[name = "childfile.txt"] childfile: File // ... }

[derive(Shape)]

struct MyShapedDir { #[name = "myfile.txt"] myfile: File, #[pattern = "*.txt"] mydir: Dir, childshaped_dir: ChildShapedDir }

fn main() -> Result<()> { let file = File::new("myfile.txt"); // create the file file.create(); // write to file file.write("hello there"); // read file file.readtostring(); // => "hello there" // and much more... let dir = Dir::new("mydir"); // create the dir dir.create(); // create a file in it dir.createfile("myfile.txt").unwrap().write("hello world"); // create a dir in it dir.createdir("mydir");

let shape: Shape = Shape::new(); let shapeinst = shape.createat("target").unwrap(); println!("{:?}", shapeinst.myfile); // File println!("{:?}", shapeinst.mydir); // Dir println!("{:?}", shapeinst.childshapeddir.childfile); // File

// and much more... Ok(()) } ```

rust features

Licence

Copyright (c) 2020 AliBasicCoder