Rust ervers, Services, And Apps.
cd scenario1
# start tcpserverr
cargo run -p tcpserver
# run tcpclient
cargo run -p tcpclient
各个章节的代码基本采用 workspace 进行管理
需要注意 rust2024 edition 需要采用 resolver = "3" 来消除警告
# 创建一个 scenario1 项目
cargo new scenario1
# 需要手动编辑 项目中的 Cargo.toml 文件, 配置 workspace
[workspace] members = ["tcpserver", "tcpclient", "http", "httpserver"] resolver = "3"
添加子项目
# 创建一个 tcpserver 子项目
cargo new tcpserver
# 创建一个 lib 类型的 http 子项目
cargo new --lib http
运行子项目
# 运行 tcpserver 子项目
cargo run -p tcpserver