pub struct Workspace {
pub root: PathBuf,
pub crates: BTreeMap<String, Vec<PathBuf>>,
pub is_workspace_root: bool,
pub standalone: BTreeMap<String, Vec<PathBuf>>,
}Expand description
The crates of a workspace: every Cargo.toml under root (skipping build and vcs dirs), keyed by both the
package name and the [lib] name, - spelled _, mapped to the crate root files that claim the name —
more than one when a facade package and the library it re-exports share it (aprender’s root aprender
is pub use aprender_ml::* over crates/aprender-core, whose [lib] name is also aprender). The walk
tries each in byte order of the manifest path and keeps the first that resolves.
Fields§
§root: PathBuf§crates: BTreeMap<String, Vec<PathBuf>>§is_workspace_root: boolroot/Cargo.toml has a [workspace] table. When it does, only its members (globs honoured) minus its
exclude are crates — a stray manifest under the root (a test fixture, an excluded canary) is not a
workspace member and a binding into it does not resolve (ONT-3a).
standalone: BTreeMap<String, Vec<PathBuf>>Non-member manifests that declare their OWN [workspace] — a standalone cargo workspace under the root
(experiments/cuda-oxide/gated-rmsnorm: its own toolchain and Cargo.lock). Indexed, NOT admitted: only
a kernel: true binding naming one admits it (Workspace::admit_standalone, ONT-4c4).
Implementations§
Source§impl Workspace
impl Workspace
Sourcepub fn scan(root: &Path) -> Self
pub fn scan(root: &Path) -> Self
Scan root for manifests. A manifest without a [package] name (a virtual workspace root) contributes
nothing.
Sourcepub fn admit_standalone(&mut self, krate: &str) -> bool
pub fn admit_standalone(&mut self, krate: &str) -> bool
Admit the standalone crate krate (a kernel: true binding names it) unless a member already owns the
name. Returns whether anything was admitted.