Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

安装与编译

前置

  • Rust toolchain (edition 2024)
  • sync-core 同级目录(如 native/cr4sync + native/sync-core),靠 path = "../sync-core" 复用同步内核

编译

cd path/to/cr4sync

# 仅 CLI(默认), 体积小, 无 axum/tower 依赖
cargo build --release

# CLI + HTTP server 子命令
cargo build --release --features server

# 产物
ls target/release/cr4sync

cr4sync 是独立 cargo workspace(Cargo.toml 自带空 [workspace] 表),不并入上级 native 工作区,不共享其 Cargo.lock

feature 矩阵

feature包含二进制大小额外依赖
(默认)CLI: login/sync/up/dl/del/ls/migrate较小reqwest, rusqlite, indicatif 等
server上述 + cr4sync serve大约 +30%axum 0.7, tower-http, moka, ulid, tokio-stream

CI 矩阵建议两条都跑:

cargo test                           # CLI only
cargo clippy --all-targets -- -D warnings
cargo test --features server         # CLI + server
cargo clippy --all-targets --features server -- -D warnings

安装到系统

install -Dm755 target/release/cr4sync /usr/local/bin/cr4sync

文档构建(本文档本身)

cd path/to/cr4sync/doc
mdbook build          # 输出到 ./book/
mdbook serve --open   # 本地预览, 自动 reload

需要 mdbook:

cargo install mdbook