package_own

Crates.iopackage_own
lib.rspackage_own
version0.0.3
sourcesrc
created_at2019-11-09 12:58:11.348616
updated_at2019-11-10 01:49:11.922293
descriptionSearch cargo package path
homepagehttps://crates.io/crates/package_own
repositoryhttps://github.com/s4i/package_own
max_upload_size
id179705
size4,193
s4i (s4i)

documentation

README

Purpose

  • When installed from cargo install, find the folder where the installation package is located.

Usage1 (Search own local package)

use package_own::parent_folder;

fn main() {
    println!("{:?}", parent_folder(""));
}

Output1 (Return type: std::path::PathBuf)

 # Your OS: Windows

 > "{%USERPROFILE%}\\.cargo\\registry\\src\\github.com-{random number}\\
    {Your package. Case of this library<package_own-(version)>}\\"

 # Your OS: Linux

 $ "{$home}/.cargo/registry/src/github.com-{random number}/
    {Your package. Case of this library<package_own-(version)>}/"

Usage2 (Add an arbitrary path to the searched package path)

use package_own::parent_folder;

fn main() {
    println!("{:?}", parent_folder("src/main.rs"));
}

Output2 (Return type: std::path::PathBuf)

 # Your OS: Windows

 > "{%USERPROFILE%}\\.cargo\\registry\\src\\github.com-{random number}\\
    {Your package. Case of this library<package_own-(version)>}\\src\\main.rs"

 # Your OS: Linux

 $ "{$home}/.cargo/registry/src/github.com-{random number}/
    {Your package. Case of this library<package_own-(version)>}/src/main.rs"
Commit count: 5

cargo fmt