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 {
26 fn lambda_context(&self) -> &Context;
28}
29
30impl LambdaConnExt for trillium::Conn {
31 fn lambda_context(&self) -> &Context {
32 self.state::<LambdaContext>()
33 .expect("lambda context should always be set inside of a lambda server")
34 }
35}