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