pub trait GlobalWithoutConfig:
Send
+ Sync
+ 'static {
// Required method
fn init() -> impl Future<Output = Result<Arc<Self>>> + Send;
// Provided methods
fn tokio_runtime() -> Runtime { ... }
fn on_services_start(
self: &Arc<Self>,
) -> impl Future<Output = Result<()>> + Send { ... }
fn on_service_exit(
self: &Arc<Self>,
name: &'static str,
result: Result<()>,
) -> impl Future<Output = Result<()>> + Send { ... }
fn on_exit(
self: &Arc<Self>,
result: Result<()>,
) -> impl Future<Output = Result<()>> + Send { ... }
}Expand description
Required Methods§
Provided Methods§
Sourcefn tokio_runtime() -> Runtime
fn tokio_runtime() -> Runtime
Builds the tokio runtime for the process.
If not overridden, a default runtime builder is used to build the runtime. It uses the following environment variables:
-
TOKIO_WORKER_THREADS: Number of worker threads to use. If 1, a current thread runtime is used.See
tokio::runtime::Builder::worker_threadsfor details. -
TOKIO_MAX_BLOCKING_THREADS: Maximum number of blocking threads.See
tokio::runtime::Builder::max_blocking_threadsfor details. -
TOKIO_DISABLE_TIME: Iftruedisables time.See
tokio::runtime::Builder::enable_timefor details. -
TOKIO_DISABLE_IO: Iftruedisables IO.See
tokio::runtime::Builder::enable_iofor details. -
TOKIO_THREAD_STACK_SIZE: Thread stack size.See
tokio::runtime::Builder::thread_stack_sizefor details. -
TOKIO_GLOBAL_QUEUE_INTERVAL: Global queue interval.See
tokio::runtime::Builder::global_queue_intervalfor details. -
TOKIO_EVENT_INTERVAL: Event interval.See
tokio::runtime::Builder::event_intervalfor details. -
TOKIO_MAX_IO_EVENTS_PER_TICK: Maximum IO events per tick.See
tokio::runtime::Builder::max_io_events_per_tickfor details.
Sourcefn on_services_start(
self: &Arc<Self>,
) -> impl Future<Output = Result<()>> + Send
fn on_services_start( self: &Arc<Self>, ) -> impl Future<Output = Result<()>> + Send
Called right before all services start.
Returning an error from this function will prevent any service from
starting and on_exit will be called with the result
of this function.
Sourcefn on_service_exit(
self: &Arc<Self>,
name: &'static str,
result: Result<()>,
) -> impl Future<Output = Result<()>> + Send
fn on_service_exit( self: &Arc<Self>, name: &'static str, result: Result<()>, ) -> impl Future<Output = Result<()>> + Send
Called after a service exits.
name is the name of the service that exited and result is the result
the service exited with. Returning an error from this function will
stop all currently running services and on_exit
will be called with the result of this function.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.