| Crates.io | rs-svc |
| lib.rs | rs-svc |
| version | 0.1.1 |
| created_at | 2024-06-05 06:37:51.000729+00 |
| updated_at | 2024-06-05 07:03:02.696158+00 |
| description | Rust service wrapper that run on Linux |
| homepage | |
| repository | https://github.com/intfish123/rs-svc |
| max_upload_size | |
| id | 1262468 |
| size | 8,740 |
Rust service wrapper that run on Linux
See examples
use rs_svc::svc::service::Service;
struct MyService;
impl Service for MyService {
fn init(&self) -> anyhow::Result<()> {
println!("init");
Ok(())
}
// must be non-blocking
fn start(&self) -> anyhow::Result<()> {
std::thread::spawn(move || {
println!("start")
});
Ok(())
}
fn stop(&self) -> anyhow::Result<()> {
print!("stop");
Ok(())
}
}
fn main() {
let my_svc = MyService;
rs_svc::svc::service::run(&my_svc).unwrap()
}