pub struct ApiResponse<T> {
pub status: u16,
pub headers: HashMap<String, String>,
pub body: T,
pub raw_body: String,
}Expand description
A typed API response that wraps the deserialized body along with HTTP metadata (status code, headers).
The generic parameter T is the type you want the JSON response
body deserialized into (e.g., Post, User, Vec<Item>).
Fields§
§status: u16The HTTP status code (e.g., 200, 201, 404).
headers: HashMap<String, String>All response headers as key-value pairs.
body: TThe deserialized response body.
raw_body: StringThe raw response body as a string (useful for debugging).
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for ApiResponse<T>where
T: Freeze,
impl<T> RefUnwindSafe for ApiResponse<T>where
T: RefUnwindSafe,
impl<T> Send for ApiResponse<T>where
T: Send,
impl<T> Sync for ApiResponse<T>where
T: Sync,
impl<T> Unpin for ApiResponse<T>where
T: Unpin,
impl<T> UnsafeUnpin for ApiResponse<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for ApiResponse<T>where
T: UnwindSafe,
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