pub struct Request<'a> { /* private fields */ }Expand description
A built HTTP request. Borrows from the RequestWriter’s buffer.
Must be consumed or dropped before the next request on the same writer.
Same lifecycle as Message<'_> in WebSocket.
Clone is cheap (copies a pointer + length, no allocation). Use it
to archive request bytes before sending:
ⓘ
let req = writer.post("/order").body(json).finish()?;
let archived = req.clone();
conn.send(req, &mut reader)?;
archive_log.write(archived.as_bytes());Implementations§
Source§impl<'a> Request<'a>
impl<'a> Request<'a>
Sourcepub fn into_bytes(self) -> &'a [u8] ⓘ
pub fn into_bytes(self) -> &'a [u8] ⓘ
Consume the request, returning the raw wire bytes.
Releases the borrow on the RequestWriter while keeping
access to the bytes (they remain valid until the writer
is used again).
ⓘ
let payload = writer.post("/order").body(json).finish()?.into_bytes();
archive_log.write(payload);Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Request<'a>
impl<'a> RefUnwindSafe for Request<'a>
impl<'a> Send for Request<'a>
impl<'a> Sync for Request<'a>
impl<'a> Unpin for Request<'a>
impl<'a> UnsafeUnpin for Request<'a>
impl<'a> UnwindSafe for Request<'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