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>

source§

fn into_response(self) -> FunctionResponse<B, S>

Convert the type into a FunctionResponse.

Auto Trait Implementations§

§

impl<B, S> Freeze for FunctionResponse<B, S>
where B: Freeze, S: Freeze,

§

impl<B, S> RefUnwindSafe for FunctionResponse<B, S>

§

impl<B, S> Send for FunctionResponse<B, S>
where B: Send, S: Send,

§

impl<B, S> Sync for FunctionResponse<B, S>
where B: Sync, S: Sync,

§

impl<B, S> Unpin for FunctionResponse<B, S>
where B: Unpin, S: Unpin,

§

impl<B, S> UnwindSafe for FunctionResponse<B, S>
where B: UnwindSafe, S: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more