cargo-bin-file 0.1.1

Read binary paths from Cargo's CARGO_BIN_FILE_* environment variables
Documentation
# cargo-bin-file

Small helper for reading binary paths from Cargo's
`CARGO_BIN_FILE_*` environment variables.

This is useful in integration tests or benchmarks where Cargo exposes the path
to a compiled binary from another package.

## What it does

Given a crate name like `example-crate`, this crate looks up:

`CARGO_BIN_FILE_EXAMPLE_CRATE`

If that environment variable does not exist, it also tries Cargo's
bin-scoped artifact variable:

`CARGO_BIN_FILE_EXAMPLE_CRATE_example-crate`

If either environment variable exists, it returns the value as a `PathBuf`.
Otherwise it returns `None`.

## Example

```rust
use cargo_bin_file::bin_path;

let key = "CARGO_BIN_FILE_EXAMPLE_CRATE";

unsafe {
    std::env::set_var(key, "/tmp/example-crate");
}

assert_eq!(
    bin_path("example-crate"),
    Some(std::path::PathBuf::from("/tmp/example-crate"))
);

unsafe {
    std::env::remove_var(key);
}
```

## Notes

- Hyphens in crate names are converted to underscores.
- ASCII letters are uppercased to match Cargo's environment variable format.
- The fallback bin-scoped key keeps the original bin name suffix because Cargo
  may expose artifact dependency paths that way.
- This crate only reads the environment variable. It does not check whether the
  resulting path exists.
- The library currently exposes a single helper, `bin_path`, for
  looking up a path by binary crate name.

## License

Licensed under either of:

- MIT
- Apache-2.0