Skip to main content

CgiResponseBody

Struct CgiResponseBody 

Source
pub struct CgiResponseBody<R, G = ()> { /* private fields */ }
Expand description

Streaming body for a CGI response: yields the leftover bytes (from the post-header read) first, then reads the rest from the child’s stdout to EOF. A total_deadline caps the total streaming time; mid-body the next poll_frame past the deadline returns an io::Error.

G is a generic drop guard that the body owns for its lifetime — typically a permit, an Arc, or a cancellation guard the host wants to keep alive while bytes are still flowing. Use () when you don’t need one.

Implementations§

Source§

impl<R, G> CgiResponseBody<R, G>

Source

pub fn new(initial: Vec<u8>, stdout: R, deadline: Instant, guard: G) -> Self

Build a body from a leftover-bytes prefix, an open reader, the wall-clock deadline for stream completion, and a caller-supplied drop guard.

Trait Implementations§

Source§

impl<R, G> Body for CgiResponseBody<R, G>
where R: AsyncRead + Unpin + Send, G: Send + Unpin + 'static,

Source§

type Data = Bytes

Values yielded by the Body.
Source§

type Error = Error

The error type this Body might generate.
Source§

fn poll_frame( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Option<Result<Frame<Self::Data>, Self::Error>>>

Attempt to pull out the next data buffer of this stream.
Source§

fn is_end_stream(&self) -> bool

Returns true when the end of stream has been reached. Read more
Source§

fn size_hint(&self) -> SizeHint

Returns the bounds on the remaining length of the stream. Read more

Auto Trait Implementations§

§

impl<R, G = ()> !Freeze for CgiResponseBody<R, G>

§

impl<R, G> RefUnwindSafe for CgiResponseBody<R, G>

§

impl<R, G> Send for CgiResponseBody<R, G>
where R: Send, G: Send,

§

impl<R, G> Sync for CgiResponseBody<R, G>
where R: Sync, G: Sync,

§

impl<R, G> Unpin for CgiResponseBody<R, G>
where R: Unpin, G: Unpin,

§

impl<R, G> UnsafeUnpin for CgiResponseBody<R, G>
where R: UnsafeUnpin, G: UnsafeUnpin,

§

impl<R, G> UnwindSafe for CgiResponseBody<R, G>
where R: UnwindSafe, G: 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, 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>,

Source§

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>,

Source§

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.