systemprompt-traits 0.1.22

Minimal shared traits and contracts for systemprompt.io
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use async_trait::async_trait;

#[async_trait]
pub trait Service: Send + Sync {
    fn name(&self) -> &str;

    async fn start(&mut self) -> Result<(), Box<dyn std::error::Error + Send + Sync>>;
    async fn stop(&mut self) -> Result<(), Box<dyn std::error::Error + Send + Sync>>;
    async fn health_check(&self) -> Result<bool, Box<dyn std::error::Error + Send + Sync>>;
}

#[async_trait]
pub trait AsyncService: Service {
    async fn run(&mut self) -> Result<(), Box<dyn std::error::Error + Send + Sync>>;
}