Skip to main content

HandlerState

Trait HandlerState 

Source
pub trait HandlerState:
    'static
    + Sync
    + Send
    + Sized {
    type StoreData: Send;
    type WorkerExpiration: WorkerExpiration;
    type WorkerState: WorkerState<StoreData = Self::StoreData>;

    // Required method
    fn instantiate(
        &self,
    ) -> impl Future<Output = Result<Instance<Self::StoreData, Self::WorkerExpiration, Self::WorkerState>>> + Send;
}
Available on crate feature component-model-async only.
Expand description

Represents the application-specific state of a web server.

Required Associated Types§

Source

type StoreData: Send

The type of the associated data for Stores created using Self::instantiate.

Source

type WorkerExpiration: WorkerExpiration

The type of the WorkerExpiration implementation to be returned from Self::instantiate.

Source

type WorkerState: WorkerState<StoreData = Self::StoreData>

The type of the WorkerState implementation to be returned from Self::instantiate.

Required Methods§

Source

fn instantiate( &self, ) -> impl Future<Output = Result<Instance<Self::StoreData, Self::WorkerExpiration, Self::WorkerState>>> + Send

Create a new store and instance for handling one or more requests.

Note that the implementer is responsible for applying a timeout to the guest instantiation if appropriate (e.g. as part of an overall request timeout).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§