Creating a Workspace

Create the Root Project Directory

mkdir project_name
cd project_name

Create a Cargo.toml in Project Root

[workspace]
 
members = [
	"project_library",
	"project_app"
]

Use cargo to Create the Packages

cargo new project_library --lib
cargo new project_app --bin

Dependencies Between Packages

In this example, the project_app crate will depend on the project_library crate.

Edit <project_root>/project_app/Cargo.toml

[dependencies]
project_library = { path = "../project_library" }

Bringing project_library Code into Scope

<project_root>/project_app/src/main.rs

use project_library; // Bring project_library into scope
 
fn main() {
	project_library::func(); // Can now call function within project_library
}