1#![deny(clippy::pedantic)]
2#![allow(
3 async_fn_in_trait,
4 clippy::clone_on_copy,
5 clippy::must_use_candidate,
6 clippy::missing_fields_in_debug,
7 clippy::missing_errors_doc,
8 clippy::missing_panics_doc,
9 clippy::unused_async
10)]
11
12use ntex_service::Service;
13
14mod manager;
15pub mod net;
16mod pool;
17mod server;
18mod wrk;
19
20pub use self::pool::WorkerPool;
21pub use self::server::Server;
22pub use self::wrk::{Worker, WorkerStatus, WorkerStop};
23
24#[derive(Default, Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
26pub struct WorkerId(pub(crate) usize);
27
28impl WorkerId {
29 pub(self) fn next(&mut self) -> WorkerId {
30 let id = WorkerId(self.0);
31 self.0 += 1;
32 id
33 }
34}
35
36pub trait ServerConfiguration: Send + Clone + 'static {
38 type Item: Send + 'static;
39 type Service: Service<(), Self::Item, Res = (), Error = ()> + 'static;
40
41 async fn create(&self) -> Result<Self::Service, &'static str>;
43
44 fn pause(&self) {}
46
47 fn resume(&self) {}
49
50 fn terminate(&self) {}
52
53 async fn stop(&self) {}
55}