pub enum ValidationError {
InvalidAppCode(String),
InvalidVersion(String),
InvalidHookTarget {
hook: String,
reason: String,
},
InvalidHookGasLimit {
gas_limit: String,
},
PartnerFeeBpsTooHigh(u32),
UnknownOrderClass(String),
InvalidReplacedOrderUid(String),
SchemaViolation {
path: String,
message: String,
},
}Expand description
A specific constraint violation found when validating an AppDataDoc.
Every variant carries enough context to display a useful diagnostic
message via its Display implementation. Variants
are returned inside
ValidationResult::typed_errors
for programmatic inspection.
§Example
use cow_rs::app_data::{AppDataDoc, ValidationError, validate_app_data_doc};
let doc = AppDataDoc::new(""); // empty appCode triggers InvalidAppCode
let result = validate_app_data_doc(&doc);
assert!(result.errors_ref().iter().any(|e| matches!(e, ValidationError::InvalidAppCode(_))));Variants§
InvalidAppCode(String)
appCode is empty or exceeds 50 characters.
InvalidVersion(String)
metadata.version is not a valid semver string (x.y.z).
InvalidHookTarget
A hook target is not a valid Ethereum address (0x + 40 hex chars).
InvalidHookGasLimit
A hook gasLimit is not parseable as a decimal u64.
PartnerFeeBpsTooHigh(u32)
partnerFee entry volumeBps / surplusBps / priceImprovementBps exceeds 10 000 (100
%).
UnknownOrderClass(String)
orderClass.orderClass contains an unrecognised variant.
InvalidReplacedOrderUid(String)
A replacedOrder UID is not 56 bytes (i.e. not "0x" + 112 hex chars).
SchemaViolation
A structural violation reported by the bundled JSON Schema validator
in super::schema — e.g. a missing required field, an unknown
property, or a value that does not match a regex / enum constraint.
Trait Implementations§
Source§impl Clone for ValidationError
impl Clone for ValidationError
Source§fn clone(&self) -> ValidationError
fn clone(&self) -> ValidationError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ValidationError
impl Debug for ValidationError
Source§impl Display for ValidationError
impl Display for ValidationError
Source§impl PartialEq for ValidationError
impl PartialEq for ValidationError
impl Eq for ValidationError
impl StructuralPartialEq for ValidationError
Auto Trait Implementations§
impl Freeze for ValidationError
impl RefUnwindSafe for ValidationError
impl Send for ValidationError
impl Sync for ValidationError
impl Unpin for ValidationError
impl UnsafeUnpin for ValidationError
impl UnwindSafe for ValidationError
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
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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.