pub struct PyContext { /* private fields */ }
Expand description

PyContext is a wrapper for context object provided by the user. It injects some values (currently only super::lambda::PyLambdaContext) that is type-hinted by the user.

PyContext is initialised during the startup, it inspects the provided context object for fields that are type-hinted to inject some values provided by the framework (see PyContext::new()).

After finding fields that needs to be injected, layer::AddPyContextLayer, a [tower::Layer], populates request-scoped values from incoming request.

And finally PyContext implements ToPyObject (so it can by passed to Python handlers) that provides PyObject provided by the user with the additional values injected by the framework.

Implementations§

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Converts self into a Python object.

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

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

👎Deprecated since 0.17.0: this trait is no longer used by PyO3, use ToPyObject or IntoPy<PyObject>
Converts self into a Python object and calls the specified closure on the native FFI pointer underlying the Python object. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more