Struct gdnative_physics::common::Variant [−]
pub struct Variant(_);
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.
Methods
impl Variant
impl Variant
pub fn from_vector2(val: &TypedVector2D<f32, UnknownUnit>) -> Variant
pub fn from_vector2(val: &TypedVector2D<f32, UnknownUnit>) -> Variant
Creates a Variant
wrapping a Vector2
.
pub fn from_vector3(val: &TypedVector3D<f32, UnknownUnit>) -> Variant
pub fn from_vector3(val: &TypedVector3D<f32, UnknownUnit>) -> Variant
Creates a Variant
wrapping a Vector3
.
pub fn from_quat(
val: &TypedRotation3D<f32, UnknownUnit, UnknownUnit>
) -> Variant
pub fn from_quat(
val: &TypedRotation3D<f32, UnknownUnit, UnknownUnit>
) -> Variant
Creates a Variant
wrapping a Quat
.
pub fn from_plane(val: &Plane) -> Variant
pub fn from_plane(val: &Plane) -> Variant
Creates a Variant
wrapping a Plane
.
pub fn from_rect2(val: &TypedRect<f32, UnknownUnit>) -> Variant
pub fn from_rect2(val: &TypedRect<f32, UnknownUnit>) -> Variant
Creates a Variant
wrapping a Rect2
.
pub fn from_transform(val: &Transform) -> Variant
pub fn from_transform(val: &Transform) -> Variant
Creates a Variant
wrapping a Transform
.
pub fn from_transform2d(
val: &TypedTransform2D<f32, UnknownUnit, UnknownUnit>
) -> Variant
pub fn from_transform2d(
val: &TypedTransform2D<f32, UnknownUnit, UnknownUnit>
) -> Variant
Creates a Variant
wrapping a Transform2D
.
pub fn from_basis(val: &Basis) -> Variant
pub fn from_basis(val: &Basis) -> Variant
Creates a Variant
wrapping a Basis
.
pub fn from_color(val: &Color) -> Variant
pub fn from_color(val: &Color) -> Variant
Creates a Variant
wrapping a Color
.
pub fn from_aabb(val: &Aabb) -> Variant
pub fn from_aabb(val: &Aabb) -> Variant
Creates a Variant
wrapping an Aabb
.
pub fn from_rid(val: &Rid) -> Variant
pub fn from_rid(val: &Rid) -> Variant
Creates a Variant
wrapping an Rid
.
pub fn from_node_path(val: &NodePath) -> Variant
pub fn from_node_path(val: &NodePath) -> Variant
Creates a Variant
wrapping a NodePath
.
pub fn from_godot_string(val: &GodotString) -> Variant
pub fn from_godot_string(val: &GodotString) -> Variant
Creates a Variant
wrapping a GodotString
.
pub fn from_array(val: &VariantArray) -> Variant
pub fn from_array(val: &VariantArray) -> Variant
Creates an Variant
wrapping an array of variants.
pub fn from_byte_array(val: &ByteArray) -> Variant
pub fn from_byte_array(val: &ByteArray) -> Variant
Creates a Variant
wrapping a byte array.
pub fn from_int32_array(val: &Int32Array) -> Variant
pub fn from_int32_array(val: &Int32Array) -> Variant
Creates a Variant
wrapping an array of 32bit signed integers.
pub fn from_float32_array(val: &Float32Array) -> Variant
pub fn from_float32_array(val: &Float32Array) -> Variant
Creates a Variant
wrapping an array of 32bit floats.
pub fn from_string_array(val: &StringArray) -> Variant
pub fn from_string_array(val: &StringArray) -> Variant
Creates a Variant
wrapping an array of godot strings.
pub fn from_vector2_array(val: &Vector2Array) -> Variant
pub fn from_vector2_array(val: &Vector2Array) -> Variant
Creates a Variant
wrapping an array of 2d vectors.
pub fn from_vector3_array(val: &Vector3Array) -> Variant
pub fn from_vector3_array(val: &Vector3Array) -> Variant
Creates a Variant
wrapping an array of 3d vectors.
pub fn from_color_array(val: &ColorArray) -> Variant
pub fn from_color_array(val: &ColorArray) -> Variant
Creates a Variant
wrapping an array of colors.
pub fn from_dictionary(val: &Dictionary) -> Variant
pub fn from_dictionary(val: &Dictionary) -> Variant
Creates a Variant
wrapping a dictionary.
pub fn new() -> Variant
pub fn new() -> Variant
Creates an empty Variant
.
pub fn from_str<S>(s: S) -> Variant where
S: AsRef<str>,
pub fn from_str<S>(s: S) -> Variant where
S: AsRef<str>,
Creates a Variant
wrapping a string.
pub fn from_object<T>(val: &T) -> Variant where
T: GodotObject,
pub fn from_object<T>(val: &T) -> Variant where
T: GodotObject,
Creates a Variant
wrapping a Godot object.
pub fn from_i64(v: i64) -> Variant
pub fn from_i64(v: i64) -> Variant
Creates a Variant
wrapping a signed integer value.
pub fn from_u64(v: u64) -> Variant
pub fn from_u64(v: u64) -> Variant
Creates a Variant
wrapping an unsigned integer value.
pub fn from_bool(v: bool) -> Variant
pub fn from_bool(v: bool) -> Variant
Creates a Variant
wrapping an boolean.
pub fn to_vector2(&self) -> TypedVector2D<f32, UnknownUnit>
pub fn to_vector2(&self) -> TypedVector2D<f32, UnknownUnit>
Do a best effort to create a Vector2
out of the variant, possibly returning a default value.
pub fn try_to_vector2(&self) -> Option<TypedVector2D<f32, UnknownUnit>>
pub fn try_to_vector2(&self) -> Option<TypedVector2D<f32, UnknownUnit>>
Returns Some(Vector2)
if this variant is one, None
otherwise.
pub fn to_vector3(&self) -> TypedVector3D<f32, UnknownUnit>
pub fn to_vector3(&self) -> TypedVector3D<f32, UnknownUnit>
Do a best effort to create a Vector3
out of the variant, possibly returning a default value.
pub fn try_to_vector3(&self) -> Option<TypedVector3D<f32, UnknownUnit>>
pub fn try_to_vector3(&self) -> Option<TypedVector3D<f32, UnknownUnit>>
Returns Some(Vector3)
if this variant is one, None
otherwise.
pub fn to_quat(&self) -> TypedRotation3D<f32, UnknownUnit, UnknownUnit>
pub fn to_quat(&self) -> TypedRotation3D<f32, UnknownUnit, UnknownUnit>
Do a best effort to create a Quat
out of the variant, possibly returning a default value.
pub fn try_to_quat(
&self
) -> Option<TypedRotation3D<f32, UnknownUnit, UnknownUnit>>
pub fn try_to_quat(
&self
) -> Option<TypedRotation3D<f32, UnknownUnit, UnknownUnit>>
Returns Some(Quat)
if this variant is one, None
otherwise.
pub fn to_plane(&self) -> Plane
pub fn to_plane(&self) -> Plane
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>
pub fn try_to_plane(&self) -> Option<Plane>
Returns Some(Plane)
if this variant is one, None
otherwise.
pub fn to_rect2(&self) -> TypedRect<f32, UnknownUnit>
pub fn to_rect2(&self) -> TypedRect<f32, UnknownUnit>
Do a best effort to create a Rect2
out of the variant, possibly returning a default value.
pub fn try_to_rect2(&self) -> Option<TypedRect<f32, UnknownUnit>>
pub fn try_to_rect2(&self) -> Option<TypedRect<f32, UnknownUnit>>
Returns Some(Rect2)
if this variant is one, None
otherwise.
pub fn to_transform(&self) -> Transform
pub fn to_transform(&self) -> Transform
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>
pub fn try_to_transform(&self) -> Option<Transform>
Returns Some(Transform)
if this variant is one, None
otherwise.
pub fn to_transform2d(&self) -> TypedTransform2D<f32, UnknownUnit, UnknownUnit>
pub fn to_transform2d(&self) -> TypedTransform2D<f32, UnknownUnit, UnknownUnit>
Do a best effort to create a Transform2D
out of the variant, possibly returning a default value.
pub fn try_to_transform2d(
&self
) -> Option<TypedTransform2D<f32, UnknownUnit, UnknownUnit>>
pub fn try_to_transform2d(
&self
) -> Option<TypedTransform2D<f32, UnknownUnit, UnknownUnit>>
Returns Some(Transform2D)
if this variant is one, None
otherwise.
pub fn to_basis(&self) -> Basis
pub fn to_basis(&self) -> Basis
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>
pub fn try_to_basis(&self) -> Option<Basis>
Returns Some(Basis)
if this variant is one, None
otherwise.
pub fn to_color(&self) -> Color
pub fn to_color(&self) -> Color
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>
pub fn try_to_color(&self) -> Option<Color>
Returns Some(Color)
if this variant is one, None
otherwise.
pub fn to_aabb(&self) -> Aabb
pub fn to_aabb(&self) -> Aabb
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>
pub fn try_to_aabb(&self) -> Option<Aabb>
Returns Some(Aabb)
if this variant is one, None
otherwise.
pub fn to_f64(&self) -> f64
pub fn to_f64(&self) -> f64
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>
pub fn try_to_f64(&self) -> Option<f64>
Returns Some(f64)
if this variant is one, None
otherwise.
pub fn to_i64(&self) -> i64
pub fn to_i64(&self) -> i64
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>
pub fn try_to_i64(&self) -> Option<i64>
Returns Some(i64)
if this variant is one, None
otherwise.
pub fn to_bool(&self) -> bool
pub fn to_bool(&self) -> bool
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>
pub fn try_to_bool(&self) -> Option<bool>
Returns Some(bool)
if this variant is one, None
otherwise.
pub fn to_node_path(&self) -> NodePath
pub fn to_node_path(&self) -> NodePath
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>
pub fn try_to_node_path(&self) -> Option<NodePath>
Returns Some(NodePath)
if this variant is one, None
otherwise.
pub fn to_godot_string(&self) -> GodotString
pub fn to_godot_string(&self) -> GodotString
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>
pub fn try_to_godot_string(&self) -> Option<GodotString>
Returns Some(GodotString)
if this variant is one, None
otherwise.
pub fn to_rid(&self) -> Rid
pub fn to_rid(&self) -> Rid
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>
pub fn try_to_rid(&self) -> Option<Rid>
Returns Some(Rid)
if this variant is one, None
otherwise.
pub fn to_array(&self) -> VariantArray
pub fn to_array(&self) -> VariantArray
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>
pub fn try_to_array(&self) -> Option<VariantArray>
Returns Some(VariantArray)
if this variant is one, None
otherwise.
pub fn to_byte_array(&self) -> ByteArray
pub fn to_byte_array(&self) -> ByteArray
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<ByteArray>
pub fn try_to_byte_array(&self) -> Option<ByteArray>
Returns Some(ByteArray)
if this variant is one, None
otherwise.
pub fn to_int32_array(&self) -> Int32Array
pub fn to_int32_array(&self) -> Int32Array
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<Int32Array>
pub fn try_to_int32_array(&self) -> Option<Int32Array>
Returns Some(Int32Array)
if this variant is one, None
otherwise.
pub fn to_float32_array(&self) -> Float32Array
pub fn to_float32_array(&self) -> Float32Array
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<Float32Array>
pub fn try_to_float32_array(&self) -> Option<Float32Array>
Returns Some(Float32Array)
if this variant is one, None
otherwise.
pub fn to_string_array(&self) -> StringArray
pub fn to_string_array(&self) -> StringArray
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<StringArray>
pub fn try_to_string_array(&self) -> Option<StringArray>
Returns Some(StringArray)
if this variant is one, None
otherwise.
pub fn to_vector2_array(&self) -> Vector2Array
pub fn to_vector2_array(&self) -> Vector2Array
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<Vector2Array>
pub fn try_to_vector2_array(&self) -> Option<Vector2Array>
Returns Some(Vector2Array)
if this variant is one, None
otherwise.
pub fn to_vector3_array(&self) -> Vector3Array
pub fn to_vector3_array(&self) -> Vector3Array
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<Vector3Array>
pub fn try_to_vector3_array(&self) -> Option<Vector3Array>
Returns Some(Vector3Array)
if this variant is one, None
otherwise.
pub fn to_color_array(&self) -> ColorArray
pub fn to_color_array(&self) -> ColorArray
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<ColorArray>
pub fn try_to_color_array(&self) -> Option<ColorArray>
Returns Some(ColorArray)
if this variant is one, None
otherwise.
pub fn to_dictionary(&self) -> Dictionary
pub fn to_dictionary(&self) -> Dictionary
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>
pub fn try_to_dictionary(&self) -> Option<Dictionary>
Returns Some(Dictionary)
if this variant is one, None
otherwise.
pub fn try_to_object<T>(&self) -> Option<T> where
T: GodotObject,
pub fn try_to_object<T>(&self) -> Option<T> where
T: GodotObject,
pub fn to_string(&self) -> String
pub fn to_string(&self) -> String
pub fn try_to_string(&self) -> Option<String>
pub fn try_to_string(&self) -> Option<String>
pub fn get_type(&self) -> VariantType
pub fn get_type(&self) -> VariantType
Returns this variant's type.
pub fn is_nil(&self) -> bool
pub fn is_nil(&self) -> bool
Returns true if this is an empty variant.
pub fn has_method(&self, method: &GodotString) -> bool
pub fn has_method(&self, method: &GodotString) -> bool
pub fn call(&mut self, method: &GodotString, args: &[Variant]) -> Result<(), ()>
pub fn call(&mut self, method: &GodotString, args: &[Variant]) -> Result<(), ()>
pub fn forget(self) -> godot_variant
pub fn forget(self) -> godot_variant
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
impl Clone for Variant
fn clone(&self) -> Variant
fn clone(&self) -> Variant
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Variant
impl Debug for Variant
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl<'l> From<&'l TypedVector3D<f32, UnknownUnit>> for Variant
impl<'l> From<&'l TypedVector3D<f32, UnknownUnit>> for Variant
fn from(val: &'l TypedVector3D<f32, UnknownUnit>) -> Variant
fn from(val: &'l TypedVector3D<f32, UnknownUnit>) -> Variant
Performs the conversion.
impl<'l> From<&'l Rid> for Variant
impl<'l> From<&'l Rid> for Variant
impl<'l> From<&'l Vector3Array> for Variant
impl<'l> From<&'l Vector3Array> for Variant
fn from(val: &'l Vector3Array) -> Variant
fn from(val: &'l Vector3Array) -> Variant
Performs the conversion.
impl From<bool> for Variant
impl From<bool> for Variant
impl<'l> From<&'l Color> for Variant
impl<'l> From<&'l Color> for Variant
impl<T> From<T> for Variant where
T: GodotObject,
impl<T> From<T> for Variant where
T: GodotObject,
impl<'l> From<&'l ColorArray> for Variant
impl<'l> From<&'l ColorArray> for Variant
fn from(val: &'l ColorArray) -> Variant
fn from(val: &'l ColorArray) -> Variant
Performs the conversion.
impl From<u64> for Variant
impl From<u64> for Variant
impl<'l> From<&'l GodotString> for Variant
impl<'l> From<&'l GodotString> for Variant
fn from(val: &'l GodotString) -> Variant
fn from(val: &'l GodotString) -> Variant
Performs the conversion.
impl<'l> From<&'l Transform> for Variant
impl<'l> From<&'l Transform> for Variant
impl<'l> From<&'l Plane> for Variant
impl<'l> From<&'l Plane> for Variant
impl<'l> From<&'l String> for Variant
impl<'l> From<&'l String> for Variant
impl<'l> From<&'l ByteArray> for Variant
impl<'l> From<&'l ByteArray> for Variant
impl<'l> From<&'l TypedVector2D<f32, UnknownUnit>> for Variant
impl<'l> From<&'l TypedVector2D<f32, UnknownUnit>> for Variant
fn from(val: &'l TypedVector2D<f32, UnknownUnit>) -> Variant
fn from(val: &'l TypedVector2D<f32, UnknownUnit>) -> Variant
Performs the conversion.
impl<'l> From<&'l Basis> for Variant
impl<'l> From<&'l Basis> for Variant
impl<'l> From<&'l NodePath> for Variant
impl<'l> From<&'l NodePath> for Variant
impl<'l> From<&'l Vector2Array> for Variant
impl<'l> From<&'l Vector2Array> for Variant
fn from(val: &'l Vector2Array) -> Variant
fn from(val: &'l Vector2Array) -> Variant
Performs the conversion.
impl<'l> From<&'l TypedTransform2D<f32, UnknownUnit, UnknownUnit>> for Variant
impl<'l> From<&'l TypedTransform2D<f32, UnknownUnit, UnknownUnit>> for Variant
fn from(val: &'l TypedTransform2D<f32, UnknownUnit, UnknownUnit>) -> Variant
fn from(val: &'l TypedTransform2D<f32, UnknownUnit, UnknownUnit>) -> Variant
Performs the conversion.
impl<'l> From<&'l Float32Array> for Variant
impl<'l> From<&'l Float32Array> for Variant
fn from(val: &'l Float32Array) -> Variant
fn from(val: &'l Float32Array) -> Variant
Performs the conversion.
impl<'l> From<&'l TypedRotation3D<f32, UnknownUnit, UnknownUnit>> for Variant
impl<'l> From<&'l TypedRotation3D<f32, UnknownUnit, UnknownUnit>> for Variant
fn from(val: &'l TypedRotation3D<f32, UnknownUnit, UnknownUnit>) -> Variant
fn from(val: &'l TypedRotation3D<f32, UnknownUnit, UnknownUnit>) -> Variant
Performs the conversion.
impl<'l> From<&'l TypedRect<f32, UnknownUnit>> for Variant
impl<'l> From<&'l TypedRect<f32, UnknownUnit>> for Variant
fn from(val: &'l TypedRect<f32, UnknownUnit>) -> Variant
fn from(val: &'l TypedRect<f32, UnknownUnit>) -> Variant
Performs the conversion.
impl<'l> From<&'l Dictionary> for Variant
impl<'l> From<&'l Dictionary> for Variant
fn from(val: &'l Dictionary) -> Variant
fn from(val: &'l Dictionary) -> Variant
Performs the conversion.
impl<'l> From<&'l Int32Array> for Variant
impl<'l> From<&'l Int32Array> for Variant
fn from(val: &'l Int32Array) -> Variant
fn from(val: &'l Int32Array) -> Variant
Performs the conversion.
impl From<i64> for Variant
impl From<i64> for Variant
impl<'l> From<&'l VariantArray> for Variant
impl<'l> From<&'l VariantArray> for Variant
fn from(val: &'l VariantArray) -> Variant
fn from(val: &'l VariantArray) -> Variant
Performs the conversion.
impl<'l> From<&'l str> for Variant
impl<'l> From<&'l str> for Variant
impl<'l> From<&'l Aabb> for Variant
impl<'l> From<&'l Aabb> for Variant
impl Default for Variant
impl Default for Variant
impl Drop for Variant
impl Drop for Variant
impl PartialEq<Variant> for Variant
impl PartialEq<Variant> for Variant