Expand description
§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,
FileTarget,
async_std::GetDirAsyncExt,
};
GetDir::new()
.targets(vec![
Target::File(FileTarget {
name: "LICENSE",
}),
])
.run_reverse_async()
.await;// This is a `tokio` example
use get_dir::{
GetDir,
Target,
FileTarget,
tokio::GetDirAsyncExt,
};
GetDir::new()
.targets(vec![
Target::File(FileTarget {
name: "LICENSE",
}),
])
.run_reverse_async()
.await;Modules§
- async_
std - Run asynchronously with
async-std/async_stdfeature. - tokio
- Run asynchronously with
tokiofeature.
Structs§
- DirTarget
- Directory target struct.
- File
Target - File target struct.
- GetDir
- Utility to get directory.
Enums§
- Target
- Enum to determine whether the target is a directory or a file.