pub enum FunctionResponse<B, S> {
BufferedResponse(B),
StreamingResponse(StreamResponse<S>),
}
Expand description
An enum representing the response of a function that can return either a buffered
response of type B
or a streaming response of type S
.
Variants§
BufferedResponse(B)
A buffered response containing the entire payload of the response. This is useful for responses that can be processed quickly and have a relatively small payload size(<= 6MB).
StreamingResponse(StreamResponse<S>)
A streaming response that delivers the payload incrementally. This is useful for large payloads(> 6MB) or responses that take a long time to generate. The client can start processing the response as soon as the first chunk is available, without waiting for the entire payload to be generated.
Trait Implementations§
Source§impl<B, S> IntoFunctionResponse<B, S> for FunctionResponse<B, S>
impl<B, S> IntoFunctionResponse<B, S> for FunctionResponse<B, S>
Source§fn into_response(self) -> FunctionResponse<B, S>
fn into_response(self) -> FunctionResponse<B, S>
Convert the type into a FunctionResponse.
Auto Trait Implementations§
impl<B, S> Freeze for FunctionResponse<B, S>
impl<B, S> RefUnwindSafe for FunctionResponse<B, S>where
B: RefUnwindSafe,
S: RefUnwindSafe,
impl<B, S> Send for FunctionResponse<B, S>
impl<B, S> Sync for FunctionResponse<B, S>
impl<B, S> Unpin for FunctionResponse<B, S>
impl<B, S> UnwindSafe for FunctionResponse<B, S>where
B: UnwindSafe,
S: UnwindSafe,
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