module-concept

Rust Workspace members and dependency boundaries

A workspace manages related packages together, but membership alone does not make one package a dependency of another. Declare the local dependency in the consumer manifest. The public library interface is then available using the dependency crate name in Rust 2024. The example uses only local files and no registry downloads. Multi-file fixture: workspace-local. The code shown is one source file, not a standalone program. Expected result (not executed): 20 Why: checkout explicitly depends on pricing and calls its public function. Common mistake: Assuming use or workspace membership adds a dependency automatically.

Formal Syntax & Structure

rust syntaxrust
[workspace] members; [dependencies] pricing = { path = "../pricing" }

Working Example

Example Snippetrust
fn main() { println!("{}", pricing::total(4)); }
Rust Reference