pub enum ItemError {
UnsupportedReceiver,
UnsupportedParamPattern {
pattern: String,
},
ParamType {
param: Ident,
source: UnsupportedType,
},
ReturnType {
source: UnsupportedType,
},
FieldType {
field: Ident,
source: UnsupportedType,
},
VariantFieldType {
variant: Ident,
field: String,
source: UnsupportedType,
},
ConstType {
source: UnsupportedType,
},
UnsupportedAsync,
UnsupportedVariadic,
UnsupportedGenericParam {
param: String,
kind: &'static str,
},
UnresolvedType {
name: String,
},
UnsupportedItemKind {
kind: &'static str,
},
}Expand description
Why one item could not be expressed in the language.
Carried by Element::Unsupported rather than raised at parse time: see
the module docs on where acceptance is enforced.
Variants§
UnsupportedReceiver
A self receiver. #[prebindgen] captures free functions only.
UnsupportedParamPattern
A parameter pattern that is not a plain name — (a, b): (u8, u8).
ParamType
A parameter’s type is not in the language.
ReturnType
A return type is not in the language.
Fields
source: UnsupportedTypeFieldType
A named struct field’s type is not in the language.
VariantFieldType
A variant payload’s type is not in the language.
Fields
source: UnsupportedTypeConstType
A const’s type is not in the language.
Fields
source: UnsupportedTypeUnsupportedAsync
An async fn.
The most dangerous shape to accept quietly: Function has a direct
return, so an async fn ping() lowers as one returning (), and a
generated wrapper calls it, drops the future and exports a function whose
body never runs.
UnsupportedVariadic
A C-variadic tail — fn f(a: u8, ...).
Function holds ordinary parameters only, so the tail would simply be
dropped from the signature.
UnsupportedGenericParam
A type or const generic parameter on the item.
The elements have no generic binder, so a T in a field or parameter
would lower as TypeKind::Named — an ordinary nominal reference into
the flat namespace, indistinguishable from a real item called T. That
loses the scoping every downstream resolver needs, and no destination
language can express an uninstantiated parameter anyway.
A lifetime parameter is not this: lifetimes are spelling and already travel in the syntax.
UnresolvedType
The item names a type the flat API does not declare.
The flat API is closed over its own names: a handle enters it through
#[prebindgen] pub type X = .., so a name with no declaration is either a
missing marker or a typo. Reporting it here replaces discovering it much
later as an unresolved converter, from whichever adapter looked first.
UnsupportedItemKind
A whole item kind the language does not model — a union, a type alias.
The proc-macro refuses to mark a use, mod, impl or macro_rules!
at all, so only the kinds it accepts can reach here.
Trait Implementations§
Source§impl Error for ItemError
impl Error for ItemError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl !Send for ItemError
impl !Sync for ItemError
impl Freeze for ItemError
impl RefUnwindSafe for ItemError
impl Unpin for ItemError
impl UnsafeUnpin for ItemError
impl UnwindSafe for ItemError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more