pub struct StreamBody { /* private fields */ }Expand description
Implementations§
Source§impl StreamBody
impl StreamBody
Sourcepub fn empty() -> StreamBody
pub fn empty() -> StreamBody
Creates an empty body.
Sourcepub fn channel() -> (PipeWriter, StreamBody)
pub fn channel() -> (PipeWriter, StreamBody)
Creates a body stream with an associated writer half.
Useful when wanting to stream chunks from another thread.
Sourcepub fn channel_with_capacity(capacity: usize) -> (PipeWriter, StreamBody)
pub fn channel_with_capacity(capacity: usize) -> (PipeWriter, StreamBody)
Creates a body stream with an associated writer half having a specific size of internal buffer.
Useful when wanting to stream chunks from another thread.
Sourcepub fn from_reader<R: AsyncRead + Unpin + Send + 'static>(r: R) -> StreamBody
pub fn from_reader<R: AsyncRead + Unpin + Send + 'static>(r: R) -> StreamBody
A helper method to convert an AsyncRead to a StreamBody. If there is any error
thrown during the reading/writing, it will be logged via log::error!.
Trait Implementations§
Source§impl Body for StreamBody
impl Body for StreamBody
Source§type Data = StreamData
type Data = StreamData
Values yielded by the
Body.Source§fn poll_data(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Option<Result<Self::Data, Self::Error>>>
fn poll_data( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Option<Result<Self::Data, Self::Error>>>
Attempt to pull out the next data buffer of this stream.
Source§fn poll_trailers(
self: Pin<&mut Self>,
_cx: &mut Context<'_>,
) -> Poll<Result<Option<HeaderMap<HeaderValue>>, Self::Error>>
fn poll_trailers( self: Pin<&mut Self>, _cx: &mut Context<'_>, ) -> Poll<Result<Option<HeaderMap<HeaderValue>>, Self::Error>>
Poll for an optional single
HeaderMap of trailers. Read moreSource§fn is_end_stream(&self) -> bool
fn is_end_stream(&self) -> bool
Returns
true when the end of stream has been reached. Read moreSource§fn size_hint(&self) -> SizeHint
fn size_hint(&self) -> SizeHint
Returns the bounds on the remaining length of the stream. Read more
Source§impl From<&'static [u8]> for StreamBody
impl From<&'static [u8]> for StreamBody
Source§fn from(slice: &'static [u8]) -> StreamBody
fn from(slice: &'static [u8]) -> StreamBody
Converts to this type from the input type.
Source§impl From<&'static str> for StreamBody
impl From<&'static str> for StreamBody
Source§fn from(slice: &'static str) -> StreamBody
fn from(slice: &'static str) -> StreamBody
Converts to this type from the input type.
Source§impl From<Bytes> for StreamBody
impl From<Bytes> for StreamBody
Source§fn from(chunk: Bytes) -> StreamBody
fn from(chunk: Bytes) -> StreamBody
Converts to this type from the input type.
Source§impl From<String> for StreamBody
impl From<String> for StreamBody
Source§fn from(s: String) -> StreamBody
fn from(s: String) -> StreamBody
Converts to this type from the input type.
Auto Trait Implementations§
impl !Freeze for StreamBody
impl RefUnwindSafe for StreamBody
impl Send for StreamBody
impl Sync for StreamBody
impl Unpin for StreamBody
impl UnwindSafe for StreamBody
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