pub fn discover_root(
tree: &dyn Tree,
start: &RelPath,
) -> Result<RelPath, LoadError>Expand description
Find the workspace root containing start, relative to the supplied tree.
The nearest [workspace] wins. A package belongs to it only when the
bounded member walk includes it (including transitive path dependencies).
An excluded package or a package without an ancestor workspace is its own
root. An unlisted package is refused rather than assigned to an unrelated
workspace. package.workspace selects an explicit workspace inside the
tree, whose membership must agree. No source files or processes are needed.
§Errors
Returns a LoadError for an invalid starting directory, missing manifest,
malformed or oversized manifest, inaccessible tree, conflicting workspace
declarations, unlisted package, or membership walk exceeding its bounds.
Discovery never walks above the caller’s tree boundary.
Directory symlinks are refused because their lexical ancestors need not be
the ancestors of the directory they reach.