Skip to main content

Module workspace

Module workspace 

Source
Expand description

Workspace path-dep walker.

Hot-reload coverage (#103): the file watcher and the patcher both need to know which sub-crates the user app depends on so an edit to e.g. examples/podcast/crates/podcast-ui-kit/src/top_nav.rs produces a tier-1 patch instead of being silently ignored.

discover_path_deps runs cargo metadata against the user crate’s manifest and returns every path-dep reachable from it, including the user crate itself. “Path dep” here means a workspace member (or path = "..." dep) — anything whose Package.source is None. Registry deps (crates.io) and git deps are excluded; their sources are out-of-tree and not worth watching.

The returned tuples carry the rustc-form crate name (hyphens replaced with underscores) so callers can look them up in the captured rustc-args map directly. The src dir is the absolute path to <manifest_dir>/src/ (the conventional location; binary / examples-only crates that don’t have src/ are skipped at watch time when notify refuses to attach).

Structs§

PathDepCrate
One path-dep crate as the dev loop sees it.

Functions§

discover_path_deps
Walk cargo metadata for the user crate at manifest_path and return every path-dep reachable from it, including the root package itself. Topologically ordered (parents before deps).
identify_crate_for_paths
Given a debounced batch of changed paths, return the rustc-form crate name they all map to via longest-prefix match against crates. Returns None if the batch spans multiple crates or any path is outside every known src dir — the dev loop falls back to a Tier 2 cold rebuild in that case (we can patch one crate per debounced batch, not two).