Struct truelayer_extensions::Extensions[][src]

pub struct Extensions { /* fields omitted */ }
Expand description

Extensions is a type map: values are stored and retrieved using their TypeId.

This allows storing arbitrary data that implements Sync + Send + 'static. This is useful when you need to share data between different middlewares in the middleware chain or make some values available from the handler to middlewares on the outgoing path (e.g. error class).

Implementations

Create an empty Extensions.

Insert a value into this Extensions.

If a value of this type already exists, it will be returned.

Check if container contains value for type

Get a reference to a value previously inserted on this Extensions.

Get a mutable reference to a value previously inserted on this Extensions.

Remove a value from this Extensions.

If a value of this type exists, it will be returned.

Clear the Extensions of all inserted values.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.