pub enum LambdaInvokeMode {
Buffered,
ResponseStream,
}Expand description
Lambda function invoke mode.
Controls how Lambda handles the response from your function:
LambdaInvokeMode::Buffered- Lambda buffers the entire response before returning itLambdaInvokeMode::ResponseStream- Lambda streams the response as it’s generated
§Response Streaming
Response streaming is useful for:
- Server-Sent Events (SSE)
- Large file downloads
- Real-time data feeds
- Reducing time-to-first-byte (TTFB)
To use response streaming, you must also configure your Lambda function URL
with InvokeMode: RESPONSE_STREAM.
§Examples
use lambda_web_adapter::LambdaInvokeMode;
let buffered: LambdaInvokeMode = "buffered".into();
let streaming: LambdaInvokeMode = "response_stream".into();
assert_eq!(buffered, LambdaInvokeMode::Buffered);
assert_eq!(streaming, LambdaInvokeMode::ResponseStream);Variants§
Buffered
Buffered mode - Lambda buffers the entire response before returning. This is the default mode and works with all Lambda invocation methods.
ResponseStream
Response streaming mode - Lambda streams the response as it’s generated.
Requires Lambda function URL with InvokeMode: RESPONSE_STREAM.
Trait Implementations§
Source§impl Clone for LambdaInvokeMode
impl Clone for LambdaInvokeMode
Source§fn clone(&self) -> LambdaInvokeMode
fn clone(&self) -> LambdaInvokeMode
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LambdaInvokeMode
impl Debug for LambdaInvokeMode
Source§impl Default for LambdaInvokeMode
impl Default for LambdaInvokeMode
Source§fn default() -> LambdaInvokeMode
fn default() -> LambdaInvokeMode
Returns the “default value” for a type. Read more
Source§impl From<&str> for LambdaInvokeMode
impl From<&str> for LambdaInvokeMode
Source§impl PartialEq for LambdaInvokeMode
impl PartialEq for LambdaInvokeMode
impl Copy for LambdaInvokeMode
impl Eq for LambdaInvokeMode
impl StructuralPartialEq for LambdaInvokeMode
Auto Trait Implementations§
impl Freeze for LambdaInvokeMode
impl RefUnwindSafe for LambdaInvokeMode
impl Send for LambdaInvokeMode
impl Sync for LambdaInvokeMode
impl Unpin for LambdaInvokeMode
impl UnsafeUnpin for LambdaInvokeMode
impl UnwindSafe for LambdaInvokeMode
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