rs-svc

Crates.iors-svc
lib.rsrs-svc
version0.1.1
sourcesrc
created_at2024-06-05 06:37:51.000729
updated_at2024-06-05 07:03:02.696158
descriptionRust service wrapper that run on Linux
homepage
repositoryhttps://github.com/intfish123/rs-svc
max_upload_size
id1262468
size8,740
(intfish123)

documentation

https://docs.rs/rs-svc

README

rs-svc

Rust service wrapper that run on Linux

Examples

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()
}
Commit count: 6

cargo fmt