https://github.com/alilleybrinker/pathbuf
A convenient macro for building PathBufs in Rust.
https://github.com/alilleybrinker/pathbuf
rust rust-macro
Last synced: over 1 year ago
JSON representation
A convenient macro for building PathBufs in Rust.
- Host: GitHub
- URL: https://github.com/alilleybrinker/pathbuf
- Owner: alilleybrinker
- License: apache-2.0
- Created: 2023-01-13T02:53:04.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-02T20:30:48.000Z (over 2 years ago)
- Last Synced: 2025-03-17T07:04:06.005Z (over 1 year ago)
- Topics: rust, rust-macro
- Language: Rust
- Homepage:
- Size: 10.7 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# `pathbuf`
`pathbuf` is a simple crate which provides the `pathbuf` macro to
conveniently construct the Rust `PathBuf` type.
## Example
```rust
use pathbuf::pathbuf;
use std::path::PathBuf;
fn main() {
let p = pathbuf!["hello", "filename.txt"];
let expected = {
let mut temp = PathBuf::new();
temp.push("hello");
temp.push("filename.txt");
temp
};
assert_eq!(p, expected);
}
```
## License
`pathbuf` is licensed under the Apache 2.0 license, and is itself a
reproduction of the [`hc_pathbuf`][hc] crate found in Hipcheck, pulled out
into its own distinct crate for reuse.
[hc]: https://github.com/mitre/hipcheck/tree/main/libs/hc_pathbuf