38 字
1 分钟
Rust 二进制自更新
添加依赖
[dependencies] self_update = "0.23.0"
配置
use self_update::cargo_crate_version; use self_update::backends::github::Update; fn main() -> Result<(), Box<dyn std::error::Error>> { let status = Update::configure() .repo_owner("owner") .repo_name("repo_name") .bin_name("bin_name") .show_download_progress(true) .current_version(cargo_crate_version!()) .build()? .update()?; println!("Update status: `{}`!", status.version()); Ok(()) }
Rust 二进制自更新
https://blog.lpkt.cn/posts/rust-self-update/