Enum gdnative::core_types::FromVariantError
#[non_exhaustive]pub enum FromVariantError {
Show 13 variants
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: Cow<'static, str>,
},
InvalidField {
field_name: &'static str,
error: Box<FromVariantError>,
},
InvalidItem {
index: usize,
error: Box<FromVariantError>,
},
}Expand description
Error type returned by FromVariant::from_variant.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
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.
CannotCast
Cannot cast the object to the given Godot class.
InvalidLength
Length of the collection is different from the expected one.
InvalidEnumRepr
Invalid enum representation.
InvalidStructRepr
Invalid struct representation.
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
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.
InvalidInstance
Given object is not an instance of the expected NativeClass.
InvalidField
Collection contains an invalid field.
InvalidItem
Collection contains an invalid item.
Implementations§
§impl FromVariantError
impl FromVariantError
pub fn custom<T>(message: T) -> FromVariantErrorwhere
T: Display,
pub fn custom<T>(message: T) -> FromVariantErrorwhere
T: Display,
Returns a FromVariantError with a custom message.
Trait Implementations§
§impl Clone for FromVariantError
impl Clone for FromVariantError
§fn clone(&self) -> FromVariantError
fn clone(&self) -> FromVariantError
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for FromVariantError
impl Debug for FromVariantError
§impl Display for FromVariantError
impl Display for FromVariantError
§impl Error for FromVariantError
impl Error for FromVariantError
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
§impl PartialEq for FromVariantError
impl PartialEq for FromVariantError
impl Eq for FromVariantError
impl StructuralPartialEq for FromVariantError
Auto Trait Implementations§
impl Freeze for FromVariantError
impl RefUnwindSafe for FromVariantError
impl Send for FromVariantError
impl Sync for FromVariantError
impl Unpin for FromVariantError
impl UnwindSafe for FromVariantError
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.