pub struct Error { /* fields omitted */ }
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.
Creates a new error with a custom message.
Creates a new error for a field that appears twice in the input.
Creates a new error for a non-optional field that does not appear in the input.
Creates a new error for a field name that appears in the input but does not correspond
to a known field.
Creates a new error for a struct or variant that does not adhere to the supported shape.
Creates a new error for a field which has an unexpected literal type.
Creates a new error for a value which doesn't match a set of expected literals.
Creates a new error for a list which did not get enough items to proceed.
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.
Bundle a set of multiple errors into a single Error
instance.
This function will panic if errors.is_empty() == true
.
Check if this error is associated with a span in the token stream.
Deprecated since 0.8.3:
Callers should not broaden error spans. Use with_span instead.
Override the source code location of this error with a new one.
Tie a span to the error if none is already present. This is used in darling::FromMeta
and other traits to attach errors to the most specific possible location in the input
source code.
All darling
-built impls, either from the crate or from the proc macro, will call this
when appropriate during parsing, so it should not be necessary to call this unless you have
overridden:
FromMeta::from_meta
FromMeta::from_nested_meta
FromMeta::from_value
Recursively converts a tree of errors to a flattened list.
Adds a location to the error, such as a field or variant.
Locations must be added in reverse order of specificity.
Gets the number of individual errors in this error.
This function never returns 0
, as it's impossible to construct
a multi-error from an empty Vec
.
Formats the value using the given formatter. Read more
Deprecated since 1.33.0:
replaced by Error::source, which can support downcasting
The lower-level cause of this error, if any. Read more
The lower-level source of this error, if any. Read more
Formats the value using the given formatter. Read more
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
Converts the given value to a String
. Read more
type Error = !
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static