Crates.io | greattraits |
lib.rs | greattraits |
version | 0.1.0 |
source | src |
created_at | 2024-09-14 11:11:31.815822 |
updated_at | 2024-09-14 11:11:31.815822 |
description | My own collection for traits extending standard library types |
homepage | |
repository | https://github.com/denizsincar29/greattraits |
max_upload_size | |
id | 1374688 |
size | 6,122 |
A collection of great traits extending rust's standard library.
For now, this collection includes only one trait, but I plan to add more in the future.
A trait for path manipulation. (only Path, but want to extend to PathBuf). It supports several methods to open a file, delete a file, create, as well as open in bufread and bufwrite mode.
Use a simple shell command to install the crate:
cargo add greattraits
Then, you can use the trait in your code:
use greattraits::Pathjects;
fn main(){
let folder = Path::new("myfolder");
folder.mkdir().expect("cannot create folder");
let txt=folder.join("hello.txt");
let mut f=txt.create().expect("cannot create file");
write!(f, "hello!").expect("cannot write file");
txt.delete().expect("can't delete!");
folder.delete().expect("can't delete folder!");
}
This is my hobby project and i'm still not knowledgeable about licensing. But someone told me that MIT is a good license, so I'm using it. If you have any suggestions, please let me know.