State

Trait State 

Source
pub trait State:
    Send
    + Sync
    + 'static {
    type Context: Send + Sync + 'static;

    // Required method
    fn new_context(&self) -> Self::Context;
}
Expand description

State must be implemented for any type being used as the App’s state

State is shared by all requests, and must be safe to be shared between threads (Send + Sync + ’static)

The state also creates the Context objects used to store request local data. Before processing a request a new context is created

Required Associated Types§

Source

type Context: Send + Sync + 'static

Type of the request local context

Required Methods§

Source

fn new_context(&self) -> Self::Context

Creating a new Context to be used for a single request

Implementations on Foreign Types§

Source§

impl State for ()

Implement state for void

Implementors§