pub struct RequestReader<R> { /* private fields */ }Expand description
Sequential request admission. Input read-ahead survives body completion and protocol switches. Failed reads and dropped head reads prohibit further admission; a dropped or cancelled body read loses no input.
Implementations§
Source§impl<R: ReadableStream> RequestReader<R>
impl<R: ReadableStream> RequestReader<R>
pub fn new(reader: R, options: Options) -> Result<Self, Error>
Sourcepub fn is_poisoned(&self) -> bool
pub fn is_poisoned(&self) -> bool
Whether a started head read failed or was dropped, a body read failed other than by cancellation, or the input was closed. The input position is then unknown and the input cannot be reused. A dropped or cancelled body read, or a body left unread, does not poison input, so after a request is admitted this reports a failed read, usually of a malformed or truncated request.
pub fn is_reusable(&self) -> bool
Sourcepub async fn read_request(
&mut self,
cancellation: &Cancellation,
) -> Result<Option<(Request<IncomingBody<'_, R>>, Exchange)>, Error>
pub async fn read_request( &mut self, cancellation: &Cancellation, ) -> Result<Option<(Request<IncomingBody<'_, R>>, Exchange)>, Error>
Clean EOF between requests returns None; partial heads are errors.
Auto Trait Implementations§
impl<R> Freeze for RequestReader<R>where
R: Freeze,
impl<R> RefUnwindSafe for RequestReader<R>where
R: RefUnwindSafe,
impl<R> Send for RequestReader<R>where
R: Send,
impl<R> Sync for RequestReader<R>where
R: Sync,
impl<R> Unpin for RequestReader<R>where
R: Unpin,
impl<R> UnsafeUnpin for RequestReader<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for RequestReader<R>where
R: 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