pub struct HttpResponse {
pub status: u16,
pub headers: Vec<(String, String)>,
pub body: Vec<u8>,
}Expand description
HTTP 响应结果
Fields§
§status: u16§headers: Vec<(String, String)>§body: Vec<u8>Implementations§
Source§impl HttpResponse
impl HttpResponse
Sourcepub fn text(&self) -> Result<String, PluginError>
pub fn text(&self) -> Result<String, PluginError>
将响应体作为 UTF-8 文本返回
Sourcepub fn json<T: DeserializeOwned>(&self) -> Result<T, PluginError>
pub fn json<T: DeserializeOwned>(&self) -> Result<T, PluginError>
将响应体作为 JSON 反序列化
Trait Implementations§
Source§impl<'de> Deserialize<'de> for HttpResponse
impl<'de> Deserialize<'de> for HttpResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for HttpResponse
impl RefUnwindSafe for HttpResponse
impl Send for HttpResponse
impl Sync for HttpResponse
impl Unpin for HttpResponse
impl UnsafeUnpin for HttpResponse
impl UnwindSafe for HttpResponse
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