pub trait ValidateResponse: DeserializeOwned {
// Provided methods
fn deserialize<'de, T>(value: &'de Value) -> Result<T, Box<dyn Error>>
where T: Deserialize<'de> { ... }
fn from_value(value: &Value) -> Result<Self, Box<dyn Error>>
where Self: Sized { ... }
fn validate(&self) -> Result<(), Box<dyn Error>> { ... }
}Expand description
Trait to validate the fields of a response coming from the REST API.
Provided Methods§
Sourcefn deserialize<'de, T>(value: &'de Value) -> Result<T, Box<dyn Error>>where
T: Deserialize<'de>,
fn deserialize<'de, T>(value: &'de Value) -> Result<T, Box<dyn Error>>where
T: Deserialize<'de>,
Improved deserialization function that provides better error messages using serde_path_to_error.
fn from_value(value: &Value) -> Result<Self, Box<dyn Error>>where
Self: Sized,
fn validate(&self) -> Result<(), Box<dyn Error>>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl ValidateResponse for AccountSwitchPutResponse
Validate the account switch response.
impl ValidateResponse for AccountsGetResponse
impl ValidateResponse for AccountsPreferencesGetResponse
impl ValidateResponse for AccountsPreferencesStatusPutResponse
impl ValidateResponse for ActivityHistoryGetResponse
impl ValidateResponse for AuthenticationPostResponseV3
Validate the authentication response.
impl ValidateResponse for ConfirmsGetResponse
impl ValidateResponse for MarketsGetResponse
impl ValidateResponse for PositionDeleteResponse
impl ValidateResponse for PositionGetResponse
impl ValidateResponse for PositionPostResponse
impl ValidateResponse for PositionPutResponse
impl ValidateResponse for PositionsGetResponse
impl ValidateResponse for PricesGetResponse
impl ValidateResponse for SessionDetailsGetResponse
Validate the session details response.
impl ValidateResponse for SessionEncryptionKeyGetResponse
Validate the session encryption key response.
impl ValidateResponse for SessionRefreshTokenPostResponse
Validate the session encryption key response.
impl ValidateResponse for SprintMarketPositionsGetResponse
Validate the sprint market positions response.