Struct darling_core::error::Error
source · pub struct Error { /* private fields */ }Expand description
An error encountered during attribute parsing.
Given that most errors darling encounters represent code bugs in dependent crates, the internal structure of the error is deliberately opaque.
Implementations
sourceimpl Error
impl Error
sourcepub fn duplicate_field(name: &str) -> Self
pub fn duplicate_field(name: &str) -> Self
Creates a new error for a field that appears twice in the input.
sourcepub fn missing_field(name: &str) -> Self
pub fn missing_field(name: &str) -> Self
Creates a new error for a non-optional field that does not appear in the input.
sourcepub fn unknown_field(name: &str) -> Self
pub fn unknown_field(name: &str) -> Self
Creates a new error for a field name that appears in the input but does not correspond to a known field.
sourcepub fn unsupported_shape(shape: &str) -> Self
pub fn unsupported_shape(shape: &str) -> Self
Creates a new error for a struct or variant that does not adhere to the supported shape.
pub fn unsupported_format(format: &str) -> Self
sourcepub fn unexpected_type(ty: &str) -> Self
pub fn unexpected_type(ty: &str) -> Self
Creates a new error for a field which has an unexpected literal type.
sourcepub fn unknown_value(value: &str) -> Self
pub fn unknown_value(value: &str) -> Self
Creates a new error for a value which doesn’t match a set of expected literals.
sourcepub fn too_few_items(min: usize) -> Self
pub fn too_few_items(min: usize) -> Self
Creates a new error for a list which did not get enough items to proceed.
sourcepub fn too_many_items(max: usize) -> Self
pub fn too_many_items(max: usize) -> Self
Creates a new error when a list got more items than it supports. The max argument
is the largest number of items the receiver could accept.
sourcepub fn multiple(errors: Vec<Error>) -> Self
pub fn multiple(errors: Vec<Error>) -> Self
Bundle a set of multiple errors into a single Error instance.
Panics
This function will panic if errors.is_empty() == true.