热重启
2025年8月13日小于 1 分钟hot-restart
一个用于热重启应用程序而无需停机的 Rust 库。为服务器和长时间运行的服务提供无缝的进程替换,从而实现零停机更新和配置重载。
安装
使用以下命令添加此依赖:
cargo add hot-restart
使用示例
use hot_restart::*;
async fn before_restart_hook() {}
#[tokio::main]
async fn main() {
let res = hot_restart(
&["--once", "-x", "check", "-x", "build", "--release"],
before_restart_hook(),
)
.await;
println!("hot_restart result: {:?}", res);
}
许可证
本项目使用 MIT 协议,详情请参见 LICENSE 文件。
贡献
欢迎贡献代码!请提交 issue 或 pull request。
联系方式
如有任何问题,请联系作者 [email protected]。