pub struct ValidationResult {
pub warnings: Vec<String>,
}Expand description
Result of a successful configuration validation.
This struct contains any warnings that were generated during validation. Warnings indicate potential issues that don’t prevent the configuration from being used, but may cause suboptimal behavior.
§Example
use ccxt_core::error::ValidationResult;
let mut result = ValidationResult::new();
result.add_warning("refill_period is very short, may cause high CPU usage");
assert!(!result.warnings.is_empty());Fields§
§warnings: Vec<String>Warnings generated during validation.
These are non-fatal issues that the user should be aware of.
Implementations§
Source§impl ValidationResult
impl ValidationResult
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new empty validation result.
§Example
use ccxt_core::error::ValidationResult;
let result = ValidationResult::new();
assert!(result.warnings.is_empty());Sourcepub fn with_warnings(warnings: Vec<String>) -> Self
pub fn with_warnings(warnings: Vec<String>) -> Self
Creates a validation result with the given warnings.
§Example
use ccxt_core::error::ValidationResult;
let result = ValidationResult::with_warnings(vec![
"Warning 1".to_string(),
"Warning 2".to_string(),
]);
assert_eq!(result.warnings.len(), 2);Sourcepub fn add_warning(&mut self, warning: impl Into<String>)
pub fn add_warning(&mut self, warning: impl Into<String>)
Adds a warning to the validation result.
§Example
use ccxt_core::error::ValidationResult;
let mut result = ValidationResult::new();
result.add_warning("This is a warning");
assert_eq!(result.warnings.len(), 1);Sourcepub fn is_ok(&self) -> bool
pub fn is_ok(&self) -> bool
Returns true if there are no warnings.
§Example
use ccxt_core::error::ValidationResult;
let result = ValidationResult::new();
assert!(result.is_ok());Sourcepub fn has_warnings(&self) -> bool
pub fn has_warnings(&self) -> bool
Returns true if there are any warnings.
§Example
use ccxt_core::error::ValidationResult;
let mut result = ValidationResult::new();
result.add_warning("Warning");
assert!(result.has_warnings());Sourcepub fn merge(&mut self, other: ValidationResult)
pub fn merge(&mut self, other: ValidationResult)
Merges another validation result into this one.
§Example
use ccxt_core::error::ValidationResult;
let mut result1 = ValidationResult::new();
result1.add_warning("Warning 1");
let mut result2 = ValidationResult::new();
result2.add_warning("Warning 2");
result1.merge(result2);
assert_eq!(result1.warnings.len(), 2);Trait Implementations§
Source§impl Clone for ValidationResult
impl Clone for ValidationResult
Source§fn clone(&self) -> ValidationResult
fn clone(&self) -> ValidationResult
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 ValidationResult
impl Debug for ValidationResult
Source§impl Default for ValidationResult
impl Default for ValidationResult
Source§fn default() -> ValidationResult
fn default() -> ValidationResult
Returns the “default value” for a type. Read more
Source§impl PartialEq for ValidationResult
impl PartialEq for ValidationResult
impl Eq for ValidationResult
impl StructuralPartialEq for ValidationResult
Auto Trait Implementations§
impl Freeze for ValidationResult
impl RefUnwindSafe for ValidationResult
impl Send for ValidationResult
impl Sync for ValidationResult
impl Unpin for ValidationResult
impl UnwindSafe for ValidationResult
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