6 releases (3 breaking)

Uses new Rust 2024

new 0.4.1 Mar 12, 2025
0.4.0 Feb 22, 2025
0.3.0 Oct 13, 2024
0.2.0 Oct 9, 2024
0.1.1 Sep 26, 2024

#1499 in Filesystem

Download history 8/week @ 2024-12-12 1/week @ 2024-12-19 2/week @ 2025-02-06 136/week @ 2025-02-20 23/week @ 2025-02-27 70/week @ 2025-03-06

232 downloads per month
Used in workspace_root

MIT license

16KB
298 lines

Get Dir

An utility to get directory.

This utility searches for a target directory by checking for any directories or files that match the provided input.

Usage

Get directory by target with the following code:

use get_dir::{
    GetDir,
    Target,
    DirTarget,
};

GetDir::new()
    .targets(vec![
        Target::Dir(DirTarget {
            name: "src",  
        }),
    ])
    .run();

Or get directory by target in reverse with the following code:

use get_dir::{
    GetDir,
    Target,
    FileTarget,
};

GetDir::new()
    .targets(vec![
        Target::File(FileTarget {
            name: "LICENSE",  
        }),
    ])
    .run_reverse();

Async version also available with async-std/async_std and tokio features:

// This is a `async-std` example

use get_dir::{
    GetDir,
    Target,
    DirTarget,
    async_std::GetDirAsyncExt,
};

GetDir::new()
    .targets(vec![
        Target::Dir(DirTarget {
            name: "src",  
        }),
    ])
    .run_async()
    .await;
// This is a `tokio` example

use get_dir::{
    GetDir,
    Target,
    DirTarget,
    tokio::GetDirAsyncExt,
};

GetDir::new()
    .targets(vec![
        Target::Dir(DirTarget {
            name: "src",
        }),
    ])
    .run_async()
    .await;

License

This project is licensed under the terms of the MIT license.

Dependencies

~0–11MB
~124K SLoC