runfiles 0.2.0

Runfiles lookup library for Bazel-built Rust binaries and tests.
Documentation
  • Coverage
  • 94.44%
    17 out of 18 items documented0 out of 7 items with examples
  • Size
  • Source code size: 33.8 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 628.7 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 6s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • matts1 scentini UebelAndre

Runfiles lookup library for Bazel-built Rust binaries and tests.

USAGE:

  1. 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"],
)
  1. Import the runfiles library.
use runfiles::Runfiles;
  1. 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();

// ...