Struct aws_smithy_http_server_python::context::PyContext
source · 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§
source§impl PyContext
impl PyContext
pub fn new(inner: PyObject) -> PyResult<Self>
pub fn populate_from_extensions(&self, _ext: &Extensions)
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for PyContext
impl Send for PyContext
impl Sync for PyContext
impl Unpin for PyContext
impl UnwindSafe for PyContext
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Creates a shared type from an unshared type.
source§impl<T> ToBorrowedObject for Twhere
T: ToPyObject,
impl<T> ToBorrowedObject for Twhere T: ToPyObject,
source§fn with_borrowed_ptr<F, R>(&self, py: Python<'_>, f: F) -> Rwhere
F: FnOnce(*mut PyObject) -> R,
fn with_borrowed_ptr<F, R>(&self, py: Python<'_>, f: F) -> Rwhere F: FnOnce(*mut PyObject) -> R,
👎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