Module context

Source
Expand description

Module for API context management.

This module defines traits and structs that can be used to manage contextual data related to a request, as it is passed through a series of hyper services.

See the context_tests module below for examples of how to use.

Structs§

ContextBuilder
Wrapper type for building up contexts recursively, adding one item to the context at a time.
ContextWrapper
Context wrapper, to bind an API with a context.
ContextualPayload
This represents context provided as part of the request or the response
EmptyContext
Unit struct representing an empty context with no data in it.

Traits§

ContextWrapperExt
Trait to extend an API to make it easy to bind it to a context.
Has
Defines methods for accessing, modifying, adding and removing the data stored in a context. Used to specify the requirements that a hyper service makes on a generic context type that it receives with a request, e.g.
Pop
Defines a method for permanently extracting a value, changing the resulting type. Used to specify that a hyper service consumes some data from the context, making it unavailable to later layers, e.g.
Push
Defines a method for inserting a value, changing the resulting type. Used to specify that a hyper service adds some data from the context, making it available to later layers, e.g.