[][src]Enum gdnative::prelude::FromVariantError

pub enum FromVariantError {
    Unspecified,
    Custom(String),
    InvalidNil,
    InvalidVariantType {
        variant_type: VariantType,
        expected: VariantType,
    },
    CannotCast {
        class: String,
        to: &'static str,
    },
    InvalidLength {
        len: usize,
        expected: usize,
    },
    InvalidEnumRepr {
        expected: VariantEnumRepr,
        error: Box<FromVariantError>,
    },
    InvalidStructRepr {
        expected: VariantStructRepr,
        error: Box<FromVariantError>,
    },
    UnknownEnumVariant {
        variant: String,
        expected: &'static [&'static str],
    },
    InvalidEnumVariant {
        variant: &'static str,
        error: Box<FromVariantError>,
    },
    InvalidInstance {
        expected: &'static str,
    },
    InvalidField {
        field_name: &'static str,
        error: Box<FromVariantError>,
    },
    InvalidItem {
        index: usize,
        error: Box<FromVariantError>,
    },
}

Error type returned by FromVariant::from_variant.

Variants

Unspecified

An unspecified error.

Custom(String)

A custom error message.

InvalidNil

Null value given for a non-nullable type, with no further information given.

InvalidVariantType

Variant type is different from the expected one.

Fields of InvalidVariantType

variant_type: VariantTypeexpected: VariantType
CannotCast

Cannot cast the object to the given Godot class.

Fields of CannotCast

class: Stringto: &'static str
InvalidLength

Length of the collection is different from the expected one.

Fields of InvalidLength

len: usizeexpected: usize
InvalidEnumRepr

Invalid enum representation.

Fields of InvalidEnumRepr

expected: VariantEnumReprerror: Box<FromVariantError>
InvalidStructRepr

Invalid struct representation.

Fields of InvalidStructRepr

expected: VariantStructReprerror: Box<FromVariantError>
UnknownEnumVariant

Error indicating that the implementation encountered an enum variant that does not exist at compile time.

For example, trying to create a Result<T, E> from { "Foo": "Bar" } will result in this error, since Foo is not a valid variant of Result.

Fields of UnknownEnumVariant

variant: String

Name of the unknown variant

expected: &'static [&'static str]

Names of all expected variants known at compile time

InvalidEnumVariant

Error indicating that the implementation encountered a known enum variant, but the value is invalid for the definition.

This could result from multiple underlying reasons, detailed in the error field:

  • Missing fields.
  • Unexpected representation, e.g. { "0": "foo", "1": "bar" } for a tuple.
  • Error in a nested field.

Fields of InvalidEnumVariant

variant: &'static strerror: Box<FromVariantError>
InvalidInstance

Given object is not an instance of the expected NativeClass.

Fields of InvalidInstance

expected: &'static str
InvalidField

Collection contains an invalid field.

Fields of InvalidField

field_name: &'static strerror: Box<FromVariantError>
InvalidItem

Collection contains an invalid item.

Fields of InvalidItem

index: usizeerror: Box<FromVariantError>

Implementations

impl FromVariantError[src]

pub fn custom<T>(message: T) -> FromVariantError where
    T: Display
[src]

Returns a FromVariantError with a custom message.

Trait Implementations

impl Clone for FromVariantError[src]

impl Debug for FromVariantError[src]

impl Display for FromVariantError[src]

impl Eq for FromVariantError[src]

impl Error for FromVariantError[src]

impl PartialEq<FromVariantError> for FromVariantError[src]

impl StructuralEq for FromVariantError[src]

impl StructuralPartialEq for FromVariantError[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.