trillium_aws_lambda/
context.rs1use lamedh_runtime::Context;
2use std::ops::Deref;
3
4pub(crate) struct LambdaContext(Context);
5impl LambdaContext {
6 pub fn new(context: Context) -> Self {
7 Self(context)
8 }
9}
10
11impl Deref for LambdaContext {
12 type Target = Context;
13
14 fn deref(&self) -> &Self::Target {
15 &self.0
16 }
17}
18
19pub trait LambdaConnExt {
24 fn lambda_context(&self) -> &Context;
26}
27
28impl LambdaConnExt for trillium::Conn {
29 fn lambda_context(&self) -> &Context {
30 self.state::<LambdaContext>()
31 .expect("lambda context should always be set inside of a lambda server")
32 }
33}