pub struct Response { /* private fields */ }
Expand description
The self-referencing struct.
Implementations§
Source§impl Response
impl Response
Sourcepub fn values(&self) -> &HashMap<&str, ResponseVal<'_>>
pub fn values(&self) -> &HashMap<&str, ResponseVal<'_>>
Returns a reference to the hashmap, that contains mappings of response keys to values
Sourcepub fn raw_response(&self) -> &str
pub fn raw_response(&self) -> &str
Returns the raw response from the server. This should only ever be necessary for debugging, caching, or in case there is ever a new response format in a response, that is not yet supported. You can of course also use this to look at how horrible the S&F encoding is..
Sourcepub fn received_at(&self) -> NaiveDateTime
pub fn received_at(&self) -> NaiveDateTime
Returns the time, at which the response was received
Sourcepub fn parse(
og_body: String,
received_at: NaiveDateTime,
) -> Result<Response, SFError>
pub fn parse( og_body: String, received_at: NaiveDateTime, ) -> Result<Response, SFError>
Parses a response body from the server into a usable format You might want to use this, if you are analyzing responses from the browsers network tab. If you are trying to store/read responses to/from disk to cache them, or otherwise, you should use the sso feature to serialize/deserialize them instead
§Errors
ServerError
: If the server responsed with an errorParsingError
: If the response does not follow the standard S&F server response schema
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Response
impl<'de> Deserialize<'de> for Response
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 Response
impl RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnwindSafe for Response
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