pub struct Message<'a> { /* private fields */ }Expand description
A single HTTP message, initialized to be empty (i.e., no headers, no body).
Implementations§
Source§impl<'a> Message<'a>
impl<'a> Message<'a>
Sourcepub fn new_request(allocator: &Allocator) -> Result<Self, Error>
pub fn new_request(allocator: &Allocator) -> Result<Self, Error>
Creates a new HTTP/1.1 request message.
Sourcepub fn add_header(
&mut self,
header: &Header<impl AsRef<OsStr>, impl AsRef<OsStr>>,
) -> Result<(), Error>
pub fn add_header( &mut self, header: &Header<impl AsRef<OsStr>, impl AsRef<OsStr>>, ) -> Result<(), Error>
Add a header to this message. If the header already exists in the message, this will add a another header instead of overwriting the existing one. Use Self::set_header to overwrite potentially existing headers.
Sourcepub fn set_header(
&mut self,
header: &Header<impl AsRef<OsStr>, impl AsRef<OsStr>>,
) -> Result<(), Error>
pub fn set_header( &mut self, header: &Header<impl AsRef<OsStr>, impl AsRef<OsStr>>, ) -> Result<(), Error>
Set a header in this message. The header is added if necessary and any existing values for this name are removed.
Sourcepub fn set_request_path(&mut self, path: impl AsRef<OsStr>) -> Result<(), Error>
pub fn set_request_path(&mut self, path: impl AsRef<OsStr>) -> Result<(), Error>
Set the request path for this message.
Sourcepub fn set_request_method(
&mut self,
method: impl AsRef<OsStr>,
) -> Result<(), Error>
pub fn set_request_method( &mut self, method: impl AsRef<OsStr>, ) -> Result<(), Error>
Set the request method for this message.
Sourcepub fn get_headers(&mut self) -> Result<Headers, Error>
pub fn get_headers(&mut self) -> Result<Headers, Error>
get the headers from the message and increases the reference count for the Headers in CRT.
Sourcepub fn set_body_stream(
&mut self,
input_stream: Option<InputStream<'a>>,
) -> Option<InputStream<'a>>
pub fn set_body_stream( &mut self, input_stream: Option<InputStream<'a>>, ) -> Option<InputStream<'a>>
Sets the body input stream for this message, and returns any previously set input stream. If input_stream is None, unsets the body.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Message<'a>
impl<'a> RefUnwindSafe for Message<'a>
impl<'a> !Send for Message<'a>
impl<'a> !Sync for Message<'a>
impl<'a> Unpin for Message<'a>
impl<'a> UnwindSafe for Message<'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