shuttle v0.10使用说明

https://www.shuttle.rs/

安装或更新 shuttle

如果系统磁盘剩余空间比较少,可以通过–target-dir来指定编译时产生的临时文件目录

1
cargo install cargo-shuttle --target-dir F:\temp

登录shuttle

1
cargo shuttle login FwvYic0Pk4k35vlx

初始化

1
cargo shuttle init

部署

1
2
3
cargo shuttle deploy
# 如果未提交git,提示异常,根据提示提交或增加参数即可
cargo shuttle deploy --allow-dirty

本地运行

1
cargo shuttle run

报错解决

error:

error: couldn’t read \?\x:...\target\debug\build\rustversion-…\out/version.expr: 文件名、目录名或卷标语法不正确。 (os error 123)

answer in discord:

You may need to do a cargo +1.65 build first, and then cargo +1.65 shuttle run for it to work on windows.

1.66 may work too. The + syntax is just to run a cargo command with a specific toolchain, if your default toolchain is that version you shouldn’t need it.

  1. 对项目使用指定rust版本,方式一(实际修改了.rustup/settings.toml)

    • 在工程中执行: rustup override set 1.65
    • 移除指定的版本: rustup override unset
  2. 方式二

    • 工程中创建: rust-toolchain.toml
    • 添加内容:
    1
    2
    3
    
     [toolchain]
     channel = "1.65"
     # channel = "nightly"
    
1
2
3
4
# 使用1.65重新安装cargo-shuttle (或者直接binstall[未测])
cargo +1.65 install cargo-shuttle --force
cargo +1.65 build
cargo +1.65 shuttle run

指定项目名

创建Shuttle.toml 在里面添加: name = “your-project-name