Lab 01: Workspace Setup
Goal
Build a 2-crate workspace mimicking icn-core + icnctl to learn workspace organization and basic build flow.
Structure
lab-01-workspace/
├── Cargo.toml # Workspace manifest
├── core/
│ ├── Cargo.toml
│ └── src/lib.rs # Library crate with actor-like struct
└── cli/
├── Cargo.toml
└── src/main.rs # Binary that depends on core
Requirements
1. Workspace Setup
- Create
Cargo.tomlwith workspace members - Add
coreas library crate - Add
clias binary crate depending oncore
2. Dependencies
Add to core/Cargo.toml:
tracing = "0.1"thiserror = "1.0"serde = { version = "1.0", features = ["derive"] }
3. Core Library
In core/src/lib.rs, create:
CoreActorstruct with internal stateCoreHandlewrapping the actor- Basic request/response via synchronous API
4. CLI Binary
In cli/src/main.rs:
- Initialize tracing subscriber
- Create
CoreActor - Send a request via handle
- Print response
Done When
cargo buildsucceedscargo testruns (add at least one test)- Running
clibinary produces tracing output - You understand workspace dependency management
Resources
- Cargo Workspaces
- ICN workspace:
icn/Cargo.toml