#[non_exhaustive]pub enum ConfigValidationError {
ValueTooHigh {
field: &'static str,
value: String,
max: String,
},
ValueTooLow {
field: &'static str,
value: String,
min: String,
},
ValueInvalid {
field: &'static str,
reason: String,
},
ValueMissing {
field: &'static str,
},
}Expand description
Configuration validation error types.
This enum represents different types of validation failures that can occur when validating configuration parameters. Each variant includes the field name and relevant values for debugging.
§Example
use ccxt_core::error::ConfigValidationError;
let err = ConfigValidationError::ValueTooHigh {
field: "max_retries",
value: "15".to_string(),
max: "10".to_string(),
};
assert!(err.to_string().contains("max_retries"));
assert!(err.to_string().contains("15"));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
ValueTooHigh
Field value exceeds the maximum allowed value.
Fields
ValueTooLow
Field value is below the minimum allowed value.
Fields
ValueInvalid
Field value is invalid for reasons other than range.
Fields
ValueMissing
Required field is missing.
Implementations§
Source§impl ConfigValidationError
impl ConfigValidationError
Sourcepub fn field_name(&self) -> &'static str
pub fn field_name(&self) -> &'static str
Returns the field name associated with this error.
§Example
use ccxt_core::error::ConfigValidationError;
let err = ConfigValidationError::ValueTooHigh {
field: "max_retries",
value: "15".to_string(),
max: "10".to_string(),
};
assert_eq!(err.field_name(), "max_retries");Sourcepub fn too_high<V: Display, M: Display>(
field: &'static str,
value: V,
max: M,
) -> Self
pub fn too_high<V: Display, M: Display>( field: &'static str, value: V, max: M, ) -> Self
Creates a new ValueTooHigh error.
§Example
use ccxt_core::error::ConfigValidationError;
let err = ConfigValidationError::too_high("max_retries", 15, 10);
assert!(err.to_string().contains("max_retries"));Sourcepub fn too_low<V: Display, M: Display>(
field: &'static str,
value: V,
min: M,
) -> Self
pub fn too_low<V: Display, M: Display>( field: &'static str, value: V, min: M, ) -> Self
Creates a new ValueTooLow error.
§Example
use ccxt_core::error::ConfigValidationError;
let err = ConfigValidationError::too_low("base_delay_ms", 5, 10);
assert!(err.to_string().contains("base_delay_ms"));Trait Implementations§
Source§impl Clone for ConfigValidationError
impl Clone for ConfigValidationError
Source§fn clone(&self) -> ConfigValidationError
fn clone(&self) -> ConfigValidationError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConfigValidationError
impl Debug for ConfigValidationError
Source§impl Display for ConfigValidationError
impl Display for ConfigValidationError
Source§impl Error for ConfigValidationError
impl Error for ConfigValidationError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<ConfigValidationError> for Error
impl From<ConfigValidationError> for Error
Source§fn from(e: ConfigValidationError) -> Self
fn from(e: ConfigValidationError) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ConfigValidationError
impl PartialEq for ConfigValidationError
impl Eq for ConfigValidationError
impl StructuralPartialEq for ConfigValidationError
Auto Trait Implementations§
impl Freeze for ConfigValidationError
impl RefUnwindSafe for ConfigValidationError
impl Send for ConfigValidationError
impl Sync for ConfigValidationError
impl Unpin for ConfigValidationError
impl UnwindSafe for ConfigValidationError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.