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