pub enum FerroBody {
Full(Full<Bytes>),
Stream(SseStream),
}Expand description
Unified HTTP response body for the framework’s hyper serve loop.
Carries either a fully-buffered body (Full<Bytes>) or a streaming SSE body
(SseStream), allowing the same hyper::Response<FerroBody>
type to flow through all response-path code without dynamic dispatch or heap allocation on
the buffered hot path.
§Structural compression rule (D-06)
If a compression layer is added in a future phase it MUST match on FerroBody::Full only
and pass FerroBody::Stream through untouched. A streaming body cannot be whole-body
buffered without breaking the SSE protocol.
§Error type
FerroBody::Error = Infallible — both variants are infallible so the serve loop’s
Ok::<_, Infallible>(...) wrapper is unchanged.
Variants§
Full(Full<Bytes>)
Fully-buffered response body (the common, allocation-free path).
Stream(SseStream)
Streaming SSE body (held-open connection; yields frames as events arrive).
Implementations§
Source§impl FerroBody
impl FerroBody
Sourcepub fn is_streaming(&self) -> bool
pub fn is_streaming(&self) -> bool
Returns true if this body is the streaming Stream variant.
§Structural compression rule (D-06)
If a compression layer is added in a future phase, it must check is_streaming() and
pass FerroBody::Stream bodies through untouched — only FerroBody::Full can be
whole-body buffered without breaking the SSE protocol.
Trait Implementations§
Source§impl Body for FerroBody
impl Body for FerroBody
Source§type Error = Infallible
type Error = Infallible
Body might generate.Source§fn poll_frame(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Option<Result<Frame<Bytes>, Self::Error>>>
fn poll_frame( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Option<Result<Frame<Bytes>, Self::Error>>>
Source§fn is_end_stream(&self) -> bool
fn is_end_stream(&self) -> bool
true when the end of stream has been reached. Read moreAuto Trait Implementations§
impl !Freeze for FerroBody
impl !RefUnwindSafe for FerroBody
impl !UnwindSafe for FerroBody
impl Send for FerroBody
impl Sync for FerroBody
impl Unpin for FerroBody
impl UnsafeUnpin for FerroBody
Blanket Implementations§
Source§impl<T> BodyExt for T
impl<T> BodyExt for T
Source§fn frame(&mut self) -> Frame<'_, Self>where
Self: Unpin,
fn frame(&mut self) -> Frame<'_, Self>where
Self: Unpin,
Frame, if any.Source§fn map_frame<F, B>(self, f: F) -> MapFrame<Self, F>
fn map_frame<F, B>(self, f: F) -> MapFrame<Self, F>
Source§fn map_err<F, E>(self, f: F) -> MapErr<Self, F>
fn map_err<F, E>(self, f: F) -> MapErr<Self, F>
Source§fn boxed_unsync(self) -> UnsyncBoxBody<Self::Data, Self::Error>
fn boxed_unsync(self) -> UnsyncBoxBody<Self::Data, Self::Error>
Source§fn collect(self) -> Collect<Self>where
Self: Sized,
fn collect(self) -> Collect<Self>where
Self: Sized,
Collected body which will collect all the DATA frames
and trailers.Source§fn with_trailers<F>(self, trailers: F) -> WithTrailers<Self, F>
fn with_trailers<F>(self, trailers: F) -> WithTrailers<Self, F>
Source§fn into_data_stream(self) -> BodyDataStream<Self>where
Self: Sized,
fn into_data_stream(self) -> BodyDataStream<Self>where
Self: Sized,
BodyDataStream.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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more