#path #d33pster #system-paths #path-manager

bin+lib rustypath

Easily manage paths in rust

3 unstable releases

0.2.0 May 30, 2024
0.1.1 May 7, 2024
0.1.0 May 7, 2024

#568 in Filesystem

Download history 239/week @ 2024-05-06 16/week @ 2024-05-13 29/week @ 2024-05-20 180/week @ 2024-05-27 9/week @ 2024-06-03

241 downloads per month
Used in 4 crates

Custom license

6KB
82 lines

rustypath

Path crate for rust. Managing paths made easy.

Overview

Coverting and Managing paths in rust is now made easy.

Table of contents

Add to your project

cargo add rustypath

Usage

use rustypath::RPath;

// to create a new RPath
let rpath = RPath::new_from("/abc");

// to create from Path (std::path::Path)
let demopath = Path::from("/abc");
let rpath = RPath::new_from_path(demopath);

// to create from PathBuf
let demopbuf = PathBuf::from("/abc");
let rpath = RPath::new_from_pbuf(demopbuf);

// join more parts to it
let new_r_path = rpath.join("bca"); //will return /abc/bca

// convert to pathbuf
let pbuf = rpath.convert_to_pathbuf();

// convert to string
let string = rpath.convert_to_string();

// convert from relpath to abspath
let abspath = rpath.expand()

// convert from Option<PathBuf> to PathBuf
// suppose u get some output in Option<Pathbuf> 
let pbuf = RPath::convert_optionpathbuf_to_pbuf(p:Option<PathBuf>);

// get current dir in RPath
let current_working_dir = RPath::pwd();

// get home dir in RPath
let homedir = RPath::gethomedir();

// get clone
let rpath2 = rpath.clone();

Dependencies

~0–10MB
~61K SLoC