Skip to main content

RequestBodyWriter

Struct RequestBodyWriter 

Source
pub struct RequestBodyWriter<'scope> { /* private fields */ }
Expand description

Direct request output. Vectors move into the encoder; slices are copied by Into<Vec<u8>>. One boxed sink retains in-flight state, without allocating a future or crossing a producer queue for each frame.

Implementations§

Source§

impl RequestBodyWriter<'_>

Source

pub async fn write( &mut self, data: impl Into<Vec<u8>>, cancellation: &Cancellation, ) -> Result<(), Error>

Source

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

Source

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

Every accepted frame is already flushed to the transport. After normal close_write, also wait for final framing. This does not promise that the peer has received or processed the bytes.

Source

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

Source

pub fn close_write(&mut self, error: Option<Error>)

Signal normal closure. The connection supervisor sends final framing; use asynchronous finish when completion must be observed.

Source

pub fn abort(&mut self)

Trait Implementations§

Source§

impl WritableBody for RequestBodyWriter<'_>

Source§

type Data = Vec<u8>

Source§

type Error = Error

Source§

async fn write_frame( &mut self, frame: BodyFrame<Vec<u8>>, cancellation: &Cancellation, ) -> Result<(), Error>

Accept one whole frame. Headers follow all data; a terminal frame closes output atomically with acceptance. Later writes fail. Queue capacity becoming available does not mean the transport has released its buffers.
Source§

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

Source§

fn close_write(&mut self, error: Option<Error>)

Source§

fn abort(&mut self)

Source§

fn write( &mut self, data: Self::Data, cancellation: &Cancellation, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Write a nonfinal data frame. Use write_frame to carry fields or end.

Auto Trait Implementations§

§

impl<'scope> !RefUnwindSafe for RequestBodyWriter<'scope>

§

impl<'scope> !Sync for RequestBodyWriter<'scope>

§

impl<'scope> !UnwindSafe for RequestBodyWriter<'scope>

§

impl<'scope> Freeze for RequestBodyWriter<'scope>

§

impl<'scope> Send for RequestBodyWriter<'scope>

§

impl<'scope> Unpin for RequestBodyWriter<'scope>

§

impl<'scope> UnsafeUnpin for RequestBodyWriter<'scope>

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.