rs_svc/lib.rs
1#![doc(
2 test(attr(deny(warnings))),
3 test(attr(allow(bare_trait_objects, unknown_lints)))
4)]
5#![warn(missing_docs)]
6// Don't fail on links to things not enabled in features
7#![allow(
8 unknown_lints,
9 renamed_and_removed_lints,
10 intra_doc_link_resolution_failure,
11 broken_intra_doc_links
12)]
13// These little nifty labels saying that something needs a feature to be enabled
14#![cfg_attr(docsrs, feature(doc_cfg))]
15//! Library for rust service wrapper that run on Linux
16//! # Examples
17//! ```rust
18//! use rs_svc::svc::service::Service;
19//!
20//! struct MyService;
21//!
22//! impl Service for MyService {
23//! fn init(&self) -> anyhow::Result<()> {
24//! println!("init");
25//! Ok(())
26//! }
27//!
28//! // must be non-blocking
29//! fn start(&self) -> anyhow::Result<()> {
30//! std::thread::spawn(move || {
31//! println!("start")
32//! });
33//! Ok(())
34//! }
35//!
36//! fn stop(&self) -> anyhow::Result<()> {
37//! print!("stop");
38//! Ok(())
39//! }
40//! }
41//!
42//!
43//! fn main() {
44//! let my_svc = MyService;
45//! rs_svc::svc::service::run(&my_svc).unwrap()
46//! }
47//! ```
48
49pub mod svc;