Struct wasi_experimental_http::Response
source · [−]pub struct Response {
pub status_code: StatusCode,
/* private fields */
}
Expand description
An HTTP response
Fields
status_code: StatusCode
Implementations
sourceimpl Response
impl Response
sourcepub fn body_read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
pub fn body_read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
Read a response body in a streaming fashion.
buf
is an arbitrary large buffer, that may be partially filled after each call.
The function returns the actual number of bytes that were written, and 0
when the end of the stream has been reached.
sourcepub fn body_read_all(&mut self) -> Result<Vec<u8>, Error>
pub fn body_read_all(&mut self) -> Result<Vec<u8>, Error>
Read the entire body until the end of the stream.
sourcepub fn header_get(&self, name: String) -> Result<String, Error>
pub fn header_get(&self, name: String) -> Result<String, Error>
Get the value of the name
header.
Returns HttpError::HeaderNotFound
if no such header was found.
sourcepub fn headers_get_all(&self) -> Result<HeaderMap, Error>
pub fn headers_get_all(&self) -> Result<HeaderMap, Error>
Get the entire response header map for a given request.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnwindSafe for Response
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more