pub struct StreamDataBody<T> { /* private fields */ }Expand description
Bidirectional adapter between Stream and Body:
- When the inner value implements
Body, this type implementsStreamyieldingResult<Body::Data, Body::Error>. Trailer frames are ignored and treated as end of stream. - When the inner value implements
Stream, this type implementsBodywrapping each streamed item intoFrame::Data.
Implementations§
Source§impl<T> StreamDataBody<T>
impl<T> StreamDataBody<T>
pub fn new(value: T) -> StreamDataBody<T>
Trait Implementations§
Source§impl<S, T, E> Body for StreamDataBody<S>
impl<S, T, E> Body for StreamDataBody<S>
Source§type Data = T
type Data = T
The payload data type yielded by
Frame::Data variants.Source§fn poll_frame(
self: Pin<&mut StreamDataBody<S>>,
cx: &mut Context<'_>,
) -> Poll<Option<Result<Frame<<StreamDataBody<S> as Body>::Data>, <StreamDataBody<S> as Body>::Error>>>
fn poll_frame( self: Pin<&mut StreamDataBody<S>>, cx: &mut Context<'_>, ) -> Poll<Option<Result<Frame<<StreamDataBody<S> as Body>::Data>, <StreamDataBody<S> as Body>::Error>>>
Attempt to pull the next frame from the body. Read more
Source§fn is_end_stream(&self) -> bool
fn is_end_stream(&self) -> bool
Indicates whether the body has been fully consumed. Read more
Source§impl<T> Debug for StreamDataBody<T>where
T: Debug,
impl<T> Debug for StreamDataBody<T>where
T: Debug,
Source§impl<B> Stream for StreamDataBody<B>where
B: Body,
impl<B> Stream for StreamDataBody<B>where
B: Body,
Source§fn poll_next(
self: Pin<&mut StreamDataBody<B>>,
cx: &mut Context<'_>,
) -> Poll<Option<<StreamDataBody<B> as Stream>::Item>>
fn poll_next( self: Pin<&mut StreamDataBody<B>>, cx: &mut Context<'_>, ) -> Poll<Option<<StreamDataBody<B> as Stream>::Item>>
Attempt to pull out the next value of this stream, registering the
current task for wakeup if the value is not yet available, and returning
None if the stream is exhausted. Read moreimpl<'__pin, T> Unpin for StreamDataBody<T>where
<PinnedFieldsOfHelperStruct<__Origin<'__pin, T>> as PinnedFieldsOfHelperTrait>::Actual: Unpin,
Auto Trait Implementations§
impl<T> Freeze for StreamDataBody<T>where
T: Freeze,
impl<T> RefUnwindSafe for StreamDataBody<T>where
T: RefUnwindSafe,
impl<T> Send for StreamDataBody<T>where
T: Send,
impl<T> Sync for StreamDataBody<T>where
T: Sync,
impl<T> UnsafeUnpin for StreamDataBody<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for StreamDataBody<T>where
T: 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