Skip to main content

RequestWriter

Struct RequestWriter 

Source
pub struct RequestWriter<W> { /* private fields */ }
Expand description

Sequential client output. Drive this lane concurrently with ResponseReader so an upstream response can arrive before request production completes. No dialing, pooling, detached task or Expect/Continue wait policy is hidden.

Implementations§

Source§

impl<W: WritableStream> RequestWriter<W>

Source

pub fn new(writer: W) -> Self

Source

pub fn is_reusable(&self) -> bool

Whether this output lane permits another request. This does not check completion of the independent response lane.

Source

pub async fn write_request<B: ReadableBody>( &mut self, request: &mut Request<B>, cancellation: &Cancellation, ) -> Result<bool, Error>

Send one request. true permits another output message; the owner must also finish the matching response before reusing the HTTP/1 connection. The body is closed on return, including error and cancellation.

Source

pub async fn begin_request( &mut self, metadata: &RequestMetadata, cancellation: &Cancellation, ) -> Result<(), Error>

Begin imperative output. A missing content length uses chunked HTTP/1.1 framing; declared fixed lengths are checked at every write and at EOF. After failure or cancellation this lane must be retired.

Source

pub async fn write_frame<D: AsRef<[u8]>>( &mut self, frame: BodyFrame<D>, cancellation: &Cancellation, ) -> Result<(), Error>

Directly encode and flush one frame. Taking the encoder before awaiting makes a dropped, partially completed write permanently non-resumable.

Source

pub async fn flush(&mut self, cancellation: &Cancellation) -> Result<(), Error>

Flush pending transport output. A failure retires the lane; accepted bytes must not be replayed after an interrupted flush.

Source

pub async fn close(&mut self) -> Result<()>

Auto Trait Implementations§

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.