Module swagger::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

  • Wrapper type for building up contexts recursively, adding one item to the context at a time.
  • Context wrapper, to bind an API with a context.
  • Unit struct representing an empty context with no data in it.

Traits

  • 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.
  • 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.
  • 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.
  • Trait designed to ensure consistency in context used by swagger middlewares