Struct ark_api::http_request::Response
source · [−]pub struct Response {
pub status_code: u16,
/* private fields */
}
Expand description
An HTTP response object sent back from a server.
Fields
status_code: u16
HTTP status code. If it’s different from the 200 range (from 200 to 299), indicates a failure that needs to be handled.
Implementations
sourceimpl Response
impl Response
sourcepub fn into_bytes(self) -> Vec<u8>
pub fn into_bytes(self) -> Vec<u8>
Consumes the Response
object into the bytes it contains.
sourcepub fn as_bytes(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
pub fn as_bytes(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
Bytes sent back from the server.
sourcepub fn as_text(&self) -> Result<String, FromUtf8Error>
pub fn as_text(&self) -> Result<String, FromUtf8Error>
Bytes sent back from the server, interpreted as a string. Can fail if the bytes don’t represent a valid utf8 encoding.
sourcepub fn as_text_lossy(&self) -> Cow<'_, str>
pub fn as_text_lossy(&self) -> Cow<'_, str>
Bytes sent back from the server, interpreted as a string. Will interpret invalid utf8 encodings loosely, so as to return something.
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