Skip to main content

ItemError

Enum ItemError 

Source
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).

Fields

§pattern: String
§

ParamType

A parameter’s type is not in the language.

Fields

§param: Ident
§

ReturnType

A return type is not in the language.

Fields

§

FieldType

A named struct field’s type is not in the language.

Fields

§field: Ident
§

VariantFieldType

A variant payload’s type is not in the language.

Fields

§variant: Ident
§field: String

The field’s name, or its position for a tuple variant.

§

ConstType

A const’s type is not in the language.

Fields

§

UnsupportedAsync

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.

Fields

§param: String
§kind: &'static str

a type parameter / a const generic parameter.

§

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.

Fields

§name: String
§

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.

Fields

§kind: &'static str

Trait Implementations§

Source§

impl Clone for ItemError

Source§

fn clone(&self) -> ItemError

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ItemError

Source§

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

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

impl Display for ItemError

Source§

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

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

impl Error for ItemError

1.30.0 · Source§

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

Returns 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, request: &mut Request<'a>)

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

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

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

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.