logo
0
0
WeChat Login

Rust ervers, Services, And Apps.

章节代码对应

  • scenario1 <--> ch2

代码

scenario1

cd scenario1 # start tcpserverr cargo run -p tcpserver # run tcpclient cargo run -p tcpclient

Rust 相关

workspace

各个章节的代码基本采用 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

About

Rust Servers, Services, and Apps

Language
Shell37.6%
Rust32.1%
Dockerfile30.3%