Struct gdnative::core_types::Variant [−][src]
A Variant
can represent many of godot's core types.
The underlying data can be either stored inline or reference-counted, dependning on the size of the type and whether the it is trivially copyable.
Implementations
impl Variant
[src]
pub fn from_vector2(val: &Vector2D<f32, UnknownUnit>) -> Variant
[src]
Creates a Variant
wrapping a Vector2
.
pub fn from_vector3(val: &Vector3D<f32, UnknownUnit>) -> Variant
[src]
Creates a Variant
wrapping a Vector3
.
pub fn from_quat(val: &Rotation3D<f32, UnknownUnit, UnknownUnit>) -> Variant
[src]
Creates a Variant
wrapping a Quat
.
pub fn from_plane(val: &Plane) -> Variant
[src]
Creates a Variant
wrapping a Plane
.
pub fn from_rect2(val: &Rect<f32, UnknownUnit>) -> Variant
[src]
Creates a Variant
wrapping a Rect2
.
pub fn from_transform(val: &Transform) -> Variant
[src]
Creates a Variant
wrapping a Transform
.
pub fn from_transform2d(
val: &Transform2D<f32, UnknownUnit, UnknownUnit>
) -> Variant
[src]
val: &Transform2D<f32, UnknownUnit, UnknownUnit>
) -> Variant
Creates a Variant
wrapping a Transform2D
.
pub fn from_basis(val: &Basis) -> Variant
[src]
Creates a Variant
wrapping a Basis
.
pub fn from_color(val: &Color) -> Variant
[src]
Creates a Variant
wrapping a Color
.
pub fn from_aabb(val: &Aabb) -> Variant
[src]
Creates a Variant
wrapping an Aabb
.
pub fn from_rid(val: &Rid) -> Variant
[src]
Creates a Variant
wrapping an Rid
.
pub fn from_node_path(val: &NodePath) -> Variant
[src]
Creates a Variant
wrapping a NodePath
.
pub fn from_godot_string(val: &GodotString) -> Variant
[src]
Creates a Variant
wrapping a GodotString
.
pub fn from_array(val: &VariantArray<Shared>) -> Variant
[src]
Creates an Variant
wrapping an array of variants.
pub fn from_byte_array(val: &TypedArray<u8>) -> Variant
[src]
Creates a Variant
wrapping a byte array.
pub fn from_int32_array(val: &TypedArray<i32>) -> Variant
[src]
Creates a Variant
wrapping an array of 32bit signed integers.
pub fn from_float32_array(val: &TypedArray<f32>) -> Variant
[src]
Creates a Variant
wrapping an array of 32bit floats.
pub fn from_string_array(val: &TypedArray<GodotString>) -> Variant
[src]
Creates a Variant
wrapping an array of godot strings.
pub fn from_vector2_array(
val: &TypedArray<Vector2D<f32, UnknownUnit>>
) -> Variant
[src]
val: &TypedArray<Vector2D<f32, UnknownUnit>>
) -> Variant
Creates a Variant
wrapping an array of 2d vectors.
pub fn from_vector3_array(
val: &TypedArray<Vector3D<f32, UnknownUnit>>
) -> Variant
[src]
val: &TypedArray<Vector3D<f32, UnknownUnit>>
) -> Variant
Creates a Variant
wrapping an array of 3d vectors.
pub fn from_color_array(val: &TypedArray<Color>) -> Variant
[src]
Creates a Variant
wrapping an array of colors.
pub fn from_dictionary(val: &Dictionary<Shared>) -> Variant
[src]
Creates a Variant
wrapping a dictionary.
pub fn new() -> Variant
[src]
Creates an empty Variant
.
pub fn from_str<S>(s: S) -> Variant where
S: AsRef<str>,
[src]
S: AsRef<str>,
Creates a Variant
wrapping a string.
pub fn from_object<R>(val: R) -> Variant where
R: AsVariant,
[src]
R: AsVariant,
Creates a Variant
wrapping a Godot object.
pub fn from_i64(v: i64) -> Variant
[src]
Creates a Variant
wrapping a signed integer value.
pub fn from_u64(v: u64) -> Variant
[src]
Creates a Variant
wrapping an unsigned integer value.
pub fn from_f64(v: f64) -> Variant
[src]
Creates a Variant
wrapping a double-precision float value.
pub fn from_bool(v: bool) -> Variant
[src]
Creates a Variant
wrapping an boolean.
pub fn to_vector2(&self) -> Vector2D<f32, UnknownUnit>
[src]
Do a best effort to create a Vector2
out of the variant, possibly returning a default value.
pub fn try_to_vector2(&self) -> Option<Vector2D<f32, UnknownUnit>>
[src]
Returns Some(Vector2)
if this variant is one, None
otherwise.
pub fn to_vector3(&self) -> Vector3D<f32, UnknownUnit>
[src]
Do a best effort to create a Vector3
out of the variant, possibly returning a default value.
pub fn try_to_vector3(&self) -> Option<Vector3D<f32, UnknownUnit>>
[src]
Returns Some(Vector3)
if this variant is one, None
otherwise.
pub fn to_quat(&self) -> Rotation3D<f32, UnknownUnit, UnknownUnit>
[src]
Do a best effort to create a Quat
out of the variant, possibly returning a default value.
pub fn try_to_quat(&self) -> Option<Rotation3D<f32, UnknownUnit, UnknownUnit>>
[src]
Returns Some(Quat)
if this variant is one, None
otherwise.
pub fn to_rect2(&self) -> Rect<f32, UnknownUnit>
[src]
Do a best effort to create a Rect2
out of the variant, possibly returning a default value.
pub fn try_to_rect2(&self) -> Option<Rect<f32, UnknownUnit>>
[src]
Returns Some(Rect2)
if this variant is one, None
otherwise.
pub fn to_transform2d(&self) -> Transform2D<f32, UnknownUnit, UnknownUnit>
[src]
Do a best effort to create a Transform2D
out of the variant, possibly returning a default value.
pub fn try_to_transform2d(
&self
) -> Option<Transform2D<f32, UnknownUnit, UnknownUnit>>
[src]
&self
) -> Option<Transform2D<f32, UnknownUnit, UnknownUnit>>
Returns Some(Transform2D)
if this variant is one, None
otherwise.
pub fn to_f64(&self) -> f64
[src]
Do a best effort to create a f64
out of the variant, possibly returning a default value.
pub fn try_to_f64(&self) -> Option<f64>
[src]
Returns Some(f64)
if this variant is one, None
otherwise.
pub fn to_i64(&self) -> i64
[src]
Do a best effort to create an i64
out of the variant, possibly returning a default value.
pub fn try_to_i64(&self) -> Option<i64>
[src]
Returns Some(i64)
if this variant is one, None
otherwise.
pub fn to_bool(&self) -> bool
[src]
Do a best effort to create a bool
out of the variant, possibly returning a default value.
pub fn try_to_bool(&self) -> Option<bool>
[src]
Returns Some(bool)
if this variant is one, None
otherwise.
pub fn to_u64(&self) -> u64
[src]
Do a best effort to create a u64
out of the variant, possibly returning a default value.
pub fn try_to_u64(&self) -> Option<u64>
[src]
Returns Some(u64)
if this variant is one, None
otherwise.
pub fn to_plane(&self) -> Plane
[src]
Do a best effort to create a Plane
out of the variant, possibly returning a default value.
pub fn try_to_plane(&self) -> Option<Plane>
[src]
Returns Some(Plane)
if this variant is one, None
otherwise.
pub fn to_transform(&self) -> Transform
[src]
Do a best effort to create a Transform
out of the variant, possibly returning a default value.
pub fn try_to_transform(&self) -> Option<Transform>
[src]
Returns Some(Transform)
if this variant is one, None
otherwise.
pub fn to_color(&self) -> Color
[src]
Do a best effort to create a Color
out of the variant, possibly returning a default value.
pub fn try_to_color(&self) -> Option<Color>
[src]
Returns Some(Color)
if this variant is one, None
otherwise.
pub fn to_basis(&self) -> Basis
[src]
Do a best effort to create a Basis
out of the variant, possibly returning a default value.
pub fn try_to_basis(&self) -> Option<Basis>
[src]
Returns Some(Basis)
if this variant is one, None
otherwise.
pub fn to_aabb(&self) -> Aabb
[src]
Do a best effort to create an Aabb
out of the variant, possibly returning a default value.
pub fn try_to_aabb(&self) -> Option<Aabb>
[src]
Returns Some(Aabb)
if this variant is one, None
otherwise.
pub fn to_node_path(&self) -> NodePath
[src]
Do a best effort to create a NodePath
out of the variant, possibly returning a default value.
pub fn try_to_node_path(&self) -> Option<NodePath>
[src]
Returns Some(NodePath)
if this variant is one, None
otherwise.
pub fn to_godot_string(&self) -> GodotString
[src]
Do a best effort to create a GodotString
out of the variant, possibly returning a default value.
pub fn try_to_godot_string(&self) -> Option<GodotString>
[src]
Returns Some(GodotString)
if this variant is one, None
otherwise.
pub fn to_rid(&self) -> Rid
[src]
Do a best effort to create a Rid
out of the variant, possibly returning a default value.
pub fn try_to_rid(&self) -> Option<Rid>
[src]
Returns Some(Rid)
if this variant is one, None
otherwise.
pub fn to_array(&self) -> VariantArray<Shared>
[src]
Do a best effort to create a VariantArray
out of the variant, possibly returning a default value.
pub fn try_to_array(&self) -> Option<VariantArray<Shared>>
[src]
Returns Some(VariantArray)
if this variant is one, None
otherwise.
pub fn to_byte_array(&self) -> TypedArray<u8>
[src]
Do a best effort to create a ByteArray
out of the variant, possibly returning a default value.
pub fn try_to_byte_array(&self) -> Option<TypedArray<u8>>
[src]
Returns Some(ByteArray)
if this variant is one, None
otherwise.
pub fn to_int32_array(&self) -> TypedArray<i32>
[src]
Do a best effort to create an Int32Array
out of the variant, possibly returning a default value.
pub fn try_to_int32_array(&self) -> Option<TypedArray<i32>>
[src]
Returns Some(Int32Array)
if this variant is one, None
otherwise.
pub fn to_float32_array(&self) -> TypedArray<f32>
[src]
Do a best effort to create a Float32Array
out of the variant, possibly returning a default value.
pub fn try_to_float32_array(&self) -> Option<TypedArray<f32>>
[src]
Returns Some(Float32Array)
if this variant is one, None
otherwise.
pub fn to_string_array(&self) -> TypedArray<GodotString>
[src]
Do a best effort to create a StringArray
out of the variant, possibly returning a default value.
pub fn try_to_string_array(&self) -> Option<TypedArray<GodotString>>
[src]
Returns Some(StringArray)
if this variant is one, None
otherwise.
pub fn to_vector2_array(&self) -> TypedArray<Vector2D<f32, UnknownUnit>>
[src]
Do a best effort to create a Vector2Array
out of the variant, possibly returning a default value.
pub fn try_to_vector2_array(
&self
) -> Option<TypedArray<Vector2D<f32, UnknownUnit>>>
[src]
&self
) -> Option<TypedArray<Vector2D<f32, UnknownUnit>>>
Returns Some(Vector2Array)
if this variant is one, None
otherwise.
pub fn to_vector3_array(&self) -> TypedArray<Vector3D<f32, UnknownUnit>>
[src]
Do a best effort to create a Vector3Array
out of the variant, possibly returning a default value.
pub fn try_to_vector3_array(
&self
) -> Option<TypedArray<Vector3D<f32, UnknownUnit>>>
[src]
&self
) -> Option<TypedArray<Vector3D<f32, UnknownUnit>>>
Returns Some(Vector3Array)
if this variant is one, None
otherwise.
pub fn to_color_array(&self) -> TypedArray<Color>
[src]
Do a best effort to create a ColorArray
out of the variant, possibly returning a default value.
pub fn try_to_color_array(&self) -> Option<TypedArray<Color>>
[src]
Returns Some(ColorArray)
if this variant is one, None
otherwise.
pub fn to_dictionary(&self) -> Dictionary<Shared>
[src]
Do a best effort to create a Dictionary
out of the variant, possibly returning a default value.
pub fn try_to_dictionary(&self) -> Option<Dictionary<Shared>>
[src]
Returns Some(Dictionary)
if this variant is one, None
otherwise.
pub fn try_to_object<T>(&self) -> Option<Ref<T, Shared>> where
T: GodotObject,
[src]
T: GodotObject,
pub fn try_to_object_with_error<T>(
&self
) -> Result<Ref<T, Shared>, FromVariantError> where
T: GodotObject,
[src]
&self
) -> Result<Ref<T, Shared>, FromVariantError> where
T: GodotObject,
pub fn try_to_string(&self) -> Option<String>
[src]
pub fn get_type(&self) -> VariantType
[src]
Returns this variant's type.
pub fn is_nil(&self) -> bool
[src]
Returns true if this is an empty variant.
pub fn has_method(&self, method: impl Into<GodotString>) -> bool
[src]
pub fn call(
&mut self,
method: impl Into<GodotString>,
args: &[Variant]
) -> Result<Variant, CallError>
[src]
&mut self,
method: impl Into<GodotString>,
args: &[Variant]
) -> Result<Variant, CallError>
pub fn evaluate(
&self,
op: VariantOperator,
rhs: &Variant
) -> Result<Variant, InvalidOp>
[src]
&self,
op: VariantOperator,
rhs: &Variant
) -> Result<Variant, InvalidOp>
Evaluates a variant operator on self
and rhs
and returns the result on success.
Errors
Returns Err(InvalidOp)
if the result is not valid.
pub fn forget(self) -> godot_variant
[src]
Returns the internal ffi representation of the variant and consumes the rust object without running the destructor.
This should be only used when certain that the receiving side is responsible for running the destructor for the object, otherwise it is leaked.
Trait Implementations
impl Clone for Variant
[src]
impl Debug for Variant
[src]
impl Default for Variant
[src]
impl Drop for Variant
[src]
impl Eq for Variant
[src]
impl FromVariant for Variant
[src]
pub fn from_variant(variant: &Variant) -> Result<Variant, FromVariantError>
[src]
impl PartialEq<Variant> for Variant
[src]
pub fn eq(&self, other: &Variant) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl ToString for Variant
[src]
impl ToVariant for Variant
[src]
pub fn to_variant(&self) -> Variant
[src]
impl ToVariantEq for Variant
[src]
Auto Trait Implementations
impl RefUnwindSafe for Variant
[src]
impl Send for Variant
[src]
impl Sync for Variant
[src]
impl Unpin for Variant
[src]
impl UnwindSafe for Variant
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> OwnedToVariant for T where
T: ToVariant,
[src]
T: ToVariant,
pub fn owned_to_variant(self) -> Variant
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,