1#![deny(rust_2018_idioms, unreachable_pub, missing_debug_implementations)]
2#![allow(clippy::let_underscore_future)]
3
4use ntex_service::ServiceFactory;
5
6mod manager;
7pub mod net;
8mod pool;
9mod server;
10mod signals;
11mod wrk;
12
13pub use self::pool::WorkerPool;
14pub use self::server::Server;
15pub use self::signals::{signal, Signal};
16pub use self::wrk::{Worker, WorkerStatus, WorkerStop};
17
18#[derive(Default, Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
20pub struct WorkerId(usize);
21
22impl WorkerId {
23 pub(self) fn next(&mut self) -> WorkerId {
24 let id = WorkerId(self.0);
25 self.0 += 1;
26 id
27 }
28}
29
30#[allow(async_fn_in_trait)]
31pub trait ServerConfiguration: Send + Clone + 'static {
33 type Item: Send + 'static;
34 type Factory: ServiceFactory<Self::Item> + 'static;
35
36 async fn create(&self) -> Result<Self::Factory, ()>;
38
39 fn paused(&self) {}
41
42 fn resumed(&self) {}
44
45 fn terminate(&self) {}
47
48 async fn stop(&self) {}
50}