Enum amplify_syn::Error

source ·
pub enum Error {
Show 21 variants Parse(Error), NamesDontMatch(String, String), MultipleSingularValues(String), MultipleLiteralValues(String), UnsupportedLiteral(String), SingularAttrRequired(String), ParametrizedAttrRequired(String), AttributeUnknownArgument { attr: String, arg: String, }, ArgTypeProhibited { attr: String, arg: String, }, ArgNumberExceedsMax { attr: String, type_name: String, no: usize, max_no: u8, }, ArgMustNotHaveValue { attr: String, arg: String, }, ArgRequired { attr: String, arg: String, }, ArgNameMustBeIdent, ArgNameMustBeUnique { attr: String, arg: String, }, ArgValueRequired { attr: String, arg: String, }, ArgValueTypeMismatch { attr: String, arg: String, }, ArgValueMustBeLiteral, ArgValueMustBeType, ArgValueMustBeExpr, ParametrizedAttrHasNoValue(String), NestedListsNotSupported(String),
}
Expand description

Errors representing inconsistency in proc macro attribute structure

Variants§

§

Parse(Error)

Parse error from a syn crate

§

NamesDontMatch(String, String)

Names of two merged attributes must match each other

§

MultipleSingularValues(String)

Singular argument (of form #[attr = ...]) has multiple occurrences each assigned value. This is meaningless.

§

MultipleLiteralValues(String)

Multiple literal non-string values are given for a parametrized attribute in form of #[attr(literal1, literal2)]. This is meaningless.

§

UnsupportedLiteral(String)

Attribute contains unsupported literal argument

§

SingularAttrRequired(String)

Attribute must be in a singular form (#[attr] or #[attr = ...])

§

ParametrizedAttrRequired(String)

Attribute must be in a parametrized form (#[attr(...)])

§

AttributeUnknownArgument

Fields

§attr: String

Attribute name

§arg: String

Argument name

Attribute has an unknown argument

§

ArgTypeProhibited

Fields

§attr: String

Attribute name

§arg: String

Argument name

Attribute is not allowed to have argument of type arg

§

ArgNumberExceedsMax

Fields

§attr: String

Attribute name

§type_name: String

Argument type name

§no: usize

Number of arguments

§max_no: u8

Maximum allowed number of arguments

Number of arg arguments in attribute attr exceeds maximum

§

ArgMustNotHaveValue

Fields

§attr: String

Attribute name

§arg: String

Argument name

Attribute argument arg must not have a value

§

ArgRequired

Fields

§attr: String

Attribute name

§arg: String

Argument name

Attribute must has an arg argument

§

ArgNameMustBeIdent

Attribute or attribute argument name (in form of #[attr(arg = ...)]) must be an identifier (like arg) and not a path (like std::io)

§

ArgNameMustBeUnique

Fields

§attr: String

Attribute name

§arg: String

Argument name

The same argument name is used multiple times within parametrized attribute (like in #[attr(name1 = value1, name1 = value2)])

§

ArgValueRequired

Fields

§attr: String

Attribute name

§arg: String

Argument name

Attribute or attribute argument must has a value: #[attr(arg = value)]

§

ArgValueTypeMismatch

Fields

§attr: String

Attribute name

§arg: String

Argument name

Attribute value type mismatch

§

ArgValueMustBeLiteral

Parametrized attribute argument must have a literal value (string, integer etc): #[attr(arg = "value")] or #[arg = 4]

§

ArgValueMustBeType

Parametrized attribute argument must be a valid type name: #[attr(arg = u8)] or #[arg = String]

§

ArgValueMustBeExpr

Parametrized attribute argument must be a valid rust expression: #[attr(arg = 2 + 2)] or #[arg = { u16::MAX as usize }]

§

ParametrizedAttrHasNoValue(String)

Parametrized attribute (in form of #[attr(...)]) does not have a single value

§

NestedListsNotSupported(String)

👎Deprecated since 1.1.0: This error variant is not used anymore after the introduction of custom attribute parser

Lists nested within attribute arguments, like #[attr(arg(...))] are not supported

Trait Implementations§

source§

impl Clone for Error

source§

fn clone(&self) -> Error

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Error

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Error

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Error for Error

source§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
1.0.0 · source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, demand: &mut Demand<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl From<Error> for Error

source§

fn from(err: Error) -> Self

Converts to this type from the input type.
source§

impl From<Error> for Error

source§

fn from(err: Error) -> Self

Converts to this type from the input type.
source§

impl From<Infallible> for Error

source§

fn from(_: Infallible) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnwindSafe for Error

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<E> Provider for Ewhere E: Error + ?Sized,

source§

fn provide<'a>(&'a self, demand: &mut Demand<'a>)

🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to provide by using demand. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.