pub enum StreamableResponse {
Json(Value),
Stream(Pin<Box<dyn Stream<Item = Result<Value, String>> + Send>>),
Error {
status: StatusCode,
message: String,
},
}
Expand description
Streamable HTTP response types
Variants§
Json(Value)
Single JSON response
Stream(Pin<Box<dyn Stream<Item = Result<Value, String>> + Send>>)
Streaming response with multiple JSON messages
Error
Error response
Implementations§
Source§impl StreamableResponse
impl StreamableResponse
Sourcepub fn into_response(
self,
context: &StreamableHttpContext,
) -> Response<Full<Bytes>>
pub fn into_response( self, context: &StreamableHttpContext, ) -> Response<Full<Bytes>>
Convert to HTTP response
Sourcepub fn into_boxed_response(
self,
context: &StreamableHttpContext,
) -> Response<UnsyncBoxBody<Bytes, Error>>
pub fn into_boxed_response( self, context: &StreamableHttpContext, ) -> Response<UnsyncBoxBody<Bytes, Error>>
Convert to HTTP response with UnsyncBoxBody for streaming compatibility
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StreamableResponse
impl !RefUnwindSafe for StreamableResponse
impl Send for StreamableResponse
impl !Sync for StreamableResponse
impl Unpin for StreamableResponse
impl !UnwindSafe for StreamableResponse
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