rs-svc 0.1.1

Rust service wrapper that run on Linux
Documentation
  • Coverage
  • 22.22%
    2 out of 9 items documented1 out of 6 items with examples
  • Size
  • Source code size: 8.74 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 307.96 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • intfish123/rs-svc
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • intfish123

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()
}