pub struct Runfiles { /* private fields */ }
Expand description
An interface for accessing to Bazel runfiles.
Implementations§
Source§impl Runfiles
impl Runfiles
Sourcepub fn create() -> Result<Self>
pub fn create() -> Result<Self>
Creates a manifest based Runfiles object when RUNFILES_MANIFEST_FILE environment variable is present, or a directory based Runfiles object otherwise.
Sourcepub fn rlocation(&self, path: impl AsRef<Path>) -> Option<PathBuf>
pub fn rlocation(&self, path: impl AsRef<Path>) -> Option<PathBuf>
Returns the runtime path of a runfile.
Runfiles are data-dependencies of Bazel-built binaries and tests.
The returned path may not be valid. The caller should check the path’s
validity and that the path exists.
@deprecated - this is not bzlmod-aware. Prefer the rlocation!
macro or rlocation_from
Sourcepub fn rlocation_from(
&self,
path: impl AsRef<Path>,
source_repo: &str,
) -> Option<PathBuf>
pub fn rlocation_from( &self, path: impl AsRef<Path>, source_repo: &str, ) -> Option<PathBuf>
Returns the runtime path of a runfile.
Runfiles are data-dependencies of Bazel-built binaries and tests. The returned path may not be valid. The caller should check the path’s validity and that the path exists.
Typically this should be used via the rlocation!
macro to properly set source_repo.