Struct poem_lambda::Context
source · pub struct Context(pub Context);
Expand description
The Lambda function execution context.
It implements poem::FromRequest
, so it can be used as an extractor.
Example
use poem::{handler, Request};
use poem_lambda::Context;
#[handler]
fn index(req: &Request, ctx: &Context) {
println!("request_id: {}", ctx.request_id);
}
Tuple Fields§
§0: Context
Methods from Deref<Target = Context>§
pub fn deadline(&self) -> SystemTime
pub fn deadline(&self) -> SystemTime
The execution deadline for the current invocation.
Trait Implementations§
source§impl<'a> FromRequest<'a> for &'a Context
impl<'a> FromRequest<'a> for &'a Context
source§fn from_request<'life0, 'async_trait>(
req: &'a Request,
_body: &'life0 mut RequestBody
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
fn from_request<'life0, 'async_trait>( req: &'a Request, _body: &'life0 mut RequestBody ) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait,
Extract from request head and body.
Auto Trait Implementations§
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
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