pub trait ProgramResolver {
// Required method
fn resolve(&self, program: &str) -> Option<String>;
// Provided methods
fn pinned(&self, _program: &str) -> Option<String> { ... }
fn own_binaries(&self) -> Vec<String> { ... }
fn local_bin(&self, _dirs: &[String], _name: &str) -> bool { ... }
fn declared(
&self,
_dirs: &[String],
_ecosystem: Ecosystem,
_name: &str,
) -> bool { ... }
}Expand description
Resolves program names using a search path the kernel controls.
Required Methods§
Provided Methods§
Sourcefn pinned(&self, _program: &str) -> Option<String>
fn pinned(&self, _program: &str) -> Option<String>
Path recorded for program when the kernel was installed, if any.
Sourcefn own_binaries(&self) -> Vec<String>
fn own_binaries(&self) -> Vec<String>
Where OpenMoat’s own binary and its alias are installed. A command
whose program word reaches one of these files, through a link under
another name or on the search path, is decided as openmoat too, so
the rules that keep OpenMoat’s person-only commands from an agent see
it. By default the pins of openmoat and moat.
Sourcefn local_bin(&self, _dirs: &[String], _name: &str) -> bool
fn local_bin(&self, _dirs: &[String], _name: &str) -> bool
Whether a package runner’s word name names a program the project
installed: node_modules/.bin/<name> in one of dirs (the working
directory, then each parent up to the project root), which npx and
its kind run without fetching anything (ADR-102). Asked only for a word
that names no version and no package option. By default no.
Sourcefn declared(&self, _dirs: &[String], _ecosystem: Ecosystem, _name: &str) -> bool
fn declared(&self, _dirs: &[String], _ecosystem: Ecosystem, _name: &str) -> bool
Whether the nearest manifest in dirs declares the package name of
ecosystem (package.json dependencies, pyproject.toml or
uv.lock): the project chose it, so a runner fetching it is no
unknown package (ADR-102). By default no.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".