pub struct ResponseWriter<'a> { /* private fields */ }Expand description
Preflighted writer for one response frame.
Implementations§
Source§impl<'a> ResponseWriter<'a>
impl<'a> ResponseWriter<'a>
pub fn new(sink: &'a mut dyn ByteSink, max_response_bytes: u32) -> Self
pub const fn max_response_bytes(&self) -> u32
Sourcepub fn payload(
&mut self,
payload_bytes: u64,
) -> Result<ResponsePayload<'_>, ResponseWriteError>
pub fn payload( &mut self, payload_bytes: u64, ) -> Result<ResponsePayload<'_>, ResponseWriteError>
Borrow the exact success-payload destination.
The returned guard commits the same payload length that was preflighted here, preventing a caller from initializing one range and advertising another in the response header.
Sourcepub fn write_response(
&mut self,
status: StatusCode,
request_id: u64,
payload: &dyn ByteSource,
) -> Result<u32, ResponseWriteError>
pub fn write_response( &mut self, status: StatusCode, request_id: u64, payload: &dyn ByteSource, ) -> Result<u32, ResponseWriteError>
Write a bounded payload first, then atomically expose it by committing the header.
pub fn write_empty( &mut self, status: StatusCode, request_id: u64, ) -> Result<u32, ResponseWriteError>
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ResponseWriter<'a>
impl<'a> !Send for ResponseWriter<'a>
impl<'a> !Sync for ResponseWriter<'a>
impl<'a> !UnwindSafe for ResponseWriter<'a>
impl<'a> Freeze for ResponseWriter<'a>
impl<'a> Unpin for ResponseWriter<'a>
impl<'a> UnsafeUnpin for ResponseWriter<'a>
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