Struct persistent::Read [] [src]

pub struct Read<P: Key> { /* fields omitted */ }

Middleware for data that persists between Requests with read-only capabilities.

The data is stored behind an Arc, so multiple threads can have concurrent, non-blocking access.

Read can be linked as BeforeMiddleware to add data to the Request extensions and it can be linked as an AfterMiddleware to add data to the Response extensions.

Read also implements Plugin, so the data stored within can be accessed through request.get::<Read<P>>() as an Arc<P::Value>.

Methods

impl<P: Key> Read<P> where
    P::Value: Send + Sync
[src]

[src]

Construct a new pair of Read that can be passed directly to Chain::link.

The data is initialized with the passed-in value.

[src]

Construct a new Read that can be passed directly to Chain::link_before or Chain::link_after.

The data is initialized with the passed-in value.

Trait Implementations

impl<P: Key> Clone for Read<P> where
    P::Value: Send + Sync
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<P: Key> Key for Read<P> where
    P::Value: 'static, 
[src]

The value type associated with this key type.

impl<'a, 'b, P: Key> Plugin<Request<'a, 'b>> for Read<P> where
    P::Value: Send + Sync
[src]

The error type associated with this plugin.

[src]

Create the plugin from an instance of the extended type. Read more

impl<P: Key> BeforeMiddleware for Read<P> where
    P::Value: Send + Sync
[src]

[src]

Do whatever work this middleware should do with a Request object.

[src]

Respond to an error thrown by a previous BeforeMiddleware. Read more

impl<P: Key> AfterMiddleware for Read<P> where
    P::Value: Send + Sync
[src]

[src]

Do whatever post-processing this middleware should do.

[src]

Respond to an error thrown by previous AfterMiddleware, the Handler, or a BeforeMiddleware. Read more