Expand description
Runfiles lookup library for Bazel-built Rust binaries and tests.
USAGE:
- Depend on this runfiles library from your build rule:
rust_binary(
name = "my_binary",
...
data = ["//path/to/my/data.txt"],
deps = ["@rules_rust//rust/runfiles"],
)
- Import the runfiles library.
ⓘ
use runfiles::Runfiles;
- Create a Runfiles object and use `rlocation!`` to look up runfile paths:
ⓘ
use runfiles::{Runfiles, rlocation};
let r = Runfiles::create().unwrap();
let path = rlocation!(r, "my_workspace/path/to/my/data.txt").expect("Failed to locate runfile");
let f = File::open(path).unwrap();
// ...
Macros§
Structs§
- Runfiles
- An interface for accessing to Bazel runfiles.
Enums§
- Runfiles
Error - The error type for Runfiles construction.
Functions§
- find_
runfiles_ dir - Returns the .runfiles directory for the currently executing binary.
Type Aliases§
- Result
- A specialized
std::result::Result
type for