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
Attribute has an unknown argument
ArgTypeProhibited
Attribute is not allowed to have argument of type arg
ArgNumberExceedsMax
Fields
Number of arg
arguments in attribute attr
exceeds maximum
ArgMustNotHaveValue
Attribute argument arg
must not have a value
ArgRequired
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
The same argument name is used multiple times within parametrized
attribute (like in #[attr(name1 = value1, name1 = value2)]
)
ArgValueRequired
Attribute or attribute argument must has a value:
#[attr(arg = value)]
ArgValueTypeMismatch
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)
Lists nested within attribute arguments, like #[attr(arg(...))]
are not supported