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 state;
19mod wrk;
20
21pub use self::pool::WorkerPool;
22pub use self::server::Server;
23pub use self::state::{NoConfig, ServerAppConfig};
24pub use self::wrk::{Worker, WorkerStatus, WorkerStop};
25
26#[derive(Default, Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
28pub struct WorkerId(pub(crate) usize);
29
30impl WorkerId {
31 pub(self) fn next(&mut self) -> WorkerId {
32 let id = WorkerId(self.0);
33 self.0 += 1;
34 id
35 }
36}
37
38pub trait ServerConfiguration: Send + Clone + 'static {
40 type Item: Send + 'static;
41 type Service: Service<(), Self::Item, Res = (), Error = ()> + 'static;
42
43 async fn create(&self) -> std::io::Result<Self::Service>;
45
46 fn pause(&self) {}
48
49 fn resume(&self) {}
51
52 fn terminate(&self) {}
54
55 async fn stop(&self) {}
57}