Skip to main content

ServiceLifecycle

Trait ServiceLifecycle 

Source
pub trait ServiceLifecycle: Send + Sync {
    // Provided methods
    async fn start(&self) -> Result<()> { ... }
    async fn stop(&self) -> Result<()> { ... }
    async fn restart(&self) -> Result<()> { ... }
    async fn health_check(&self) -> Result<bool> { ... }
}
Expand description

🔄 服务生命周期特征

定义服务的启动、停止和健康检查生命周期管理

Provided Methods§

Source

async fn start(&self) -> Result<()>

🚀 启动服务

Source

async fn stop(&self) -> Result<()>

🛑 停止服务

Source

async fn restart(&self) -> Result<()>

🔄 重启服务

Source

async fn health_check(&self) -> Result<bool>

✅ 健康检查

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§