pub enum ModelError {
EmptyField {
field: &'static str,
},
InvalidUrl {
field: &'static str,
value: String,
},
InvalidHash {
field: &'static str,
value: String,
},
InvalidVersion {
value: String,
reason: String,
},
InvalidPackageId {
value: String,
reason: String,
},
InvalidEnumValue {
field: &'static str,
value: String,
},
SourceMismatch {
field: &'static str,
expected: String,
actual: String,
},
InvalidContract {
field: &'static str,
reason: String,
},
}Variants§
EmptyField
A required field was empty after trimming whitespace.
InvalidUrl
A URL failed parsing or used a non-HTTP scheme.
InvalidHash
A checksum field was blank or contained non-hexadecimal data.
InvalidVersion
A semantic version string could not be parsed or normalized.
InvalidPackageId
A package id could not be parsed from @winget or @scoop syntax.
InvalidEnumValue
An enum value was outside the accepted vocabulary for the field.
SourceMismatch
A typed value did not match the source that the schema expected.
InvalidContract
A higher-level invariant or contract was violated.
Implementations§
Source§impl ModelError
impl ModelError
Sourcepub fn empty(field: &'static str) -> Self
pub fn empty(field: &'static str) -> Self
Build an empty-field error for the given logical field name.
Sourcepub fn invalid_url(field: &'static str, value: impl Into<String>) -> Self
pub fn invalid_url(field: &'static str, value: impl Into<String>) -> Self
Build a URL validation error for the given logical field name.
Sourcepub fn invalid_hash(field: &'static str, value: impl Into<String>) -> Self
pub fn invalid_hash(field: &'static str, value: impl Into<String>) -> Self
Build a hash validation error for the given logical field name.
Sourcepub fn invalid_version(
value: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn invalid_version( value: impl Into<String>, reason: impl Into<String>, ) -> Self
Build a version parsing error for the original value and reason.
Sourcepub fn invalid_package_id(
value: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn invalid_package_id( value: impl Into<String>, reason: impl Into<String>, ) -> Self
Build a package-id parsing error for the original value and reason.
Sourcepub fn invalid_enum_value(field: &'static str, value: impl Into<String>) -> Self
pub fn invalid_enum_value(field: &'static str, value: impl Into<String>) -> Self
Build a generic enum-vocabulary error for the given field.
Sourcepub fn source_mismatch(
field: &'static str,
expected: impl Into<String>,
actual: impl Into<String>,
) -> Self
pub fn source_mismatch( field: &'static str, expected: impl Into<String>, actual: impl Into<String>, ) -> Self
Build a source-mismatch error when a typed record disagrees with the schema.
Sourcepub fn invalid_contract(field: &'static str, reason: impl Into<String>) -> Self
pub fn invalid_contract(field: &'static str, reason: impl Into<String>) -> Self
Build a contract error for a schema or invariant violation.
Trait Implementations§
Source§impl Clone for ModelError
impl Clone for ModelError
Source§fn clone(&self) -> ModelError
fn clone(&self) -> ModelError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more