Struct gdnative::Variant [−][src]
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
[src]
impl Variant
pub fn from_vector2(val: &Vector2) -> Variant
[src]
pub fn from_vector2(val: &Vector2) -> Variant
Creates a Variant
wrapping a Vector2
.
pub fn from_vector3(val: &Vector3) -> Variant
[src]
pub fn from_vector3(val: &Vector3) -> Variant
Creates a Variant
wrapping a Vector3
.
pub fn from_quat(val: &Quat) -> Variant
[src]
pub fn from_quat(val: &Quat) -> Variant
Creates a Variant
wrapping a Quat
.
pub fn from_plane(val: &Plane) -> Variant
[src]
pub fn from_plane(val: &Plane) -> Variant
Creates a Variant
wrapping a Plane
.
pub fn from_rect2(val: &Rect2) -> Variant
[src]
pub fn from_rect2(val: &Rect2) -> Variant
Creates a Variant
wrapping a Rect2
.
pub fn from_transform(val: &Transform) -> Variant
[src]
pub fn from_transform(val: &Transform) -> Variant
Creates a Variant
wrapping a Transform
.
pub fn from_transform2d(val: &Transform2D) -> Variant
[src]
pub fn from_transform2d(val: &Transform2D) -> Variant
Creates a Variant
wrapping a Transform2D
.
pub fn from_basis(val: &Basis) -> Variant
[src]
pub fn from_basis(val: &Basis) -> Variant
Creates a Variant
wrapping a Basis
.
pub fn from_color(val: &Color) -> Variant
[src]
pub fn from_color(val: &Color) -> Variant
Creates a Variant
wrapping a Color
.
pub fn from_aabb(val: &Aabb) -> Variant
[src]
pub fn from_aabb(val: &Aabb) -> Variant
Creates a Variant
wrapping an Aabb
.
pub fn from_rid(val: &Rid) -> Variant
[src]
pub fn from_rid(val: &Rid) -> Variant
Creates a Variant
wrapping an Rid
.
pub fn from_node_path(val: &NodePath) -> Variant
[src]
pub fn from_node_path(val: &NodePath) -> Variant
Creates a Variant
wrapping a NodePath
.
pub fn from_godot_string(val: &GodotString) -> Variant
[src]
pub fn from_godot_string(val: &GodotString) -> Variant
Creates a Variant
wrapping a GodotString
.
pub fn from_array(val: &VariantArray) -> Variant
[src]
pub fn from_array(val: &VariantArray) -> Variant
Creates an Variant
wrapping an array of variants.
pub fn from_byte_array(val: &ByteArray) -> Variant
[src]
pub fn from_byte_array(val: &ByteArray) -> Variant
Creates a Variant
wrapping a byte array.
pub fn from_int32_array(val: &Int32Array) -> Variant
[src]
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
[src]
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
[src]
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
[src]
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
[src]
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
[src]
pub fn from_color_array(val: &ColorArray) -> Variant
Creates a Variant
wrapping an array of colors.
pub fn from_dictionary(val: &Dictionary) -> Variant
[src]
pub fn from_dictionary(val: &Dictionary) -> Variant
Creates a Variant
wrapping a dictionary.
pub fn new() -> Self
[src]
pub fn new() -> Self
Creates an empty Variant
.
pub fn from_str<S>(s: S) -> Variant where
S: AsRef<str>,
[src]
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,
[src]
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
[src]
pub fn from_i64(v: i64) -> Variant
Creates a Variant
wrapping a signed integer value.
pub fn from_u64(v: u64) -> Variant
[src]
pub fn from_u64(v: u64) -> Variant
Creates a Variant
wrapping an unsigned integer value.
pub fn from_bool(v: bool) -> Variant
[src]
pub fn from_bool(v: bool) -> Variant
Creates a Variant
wrapping an boolean.
pub fn to_vector2(&self) -> Vector2
[src]
pub fn to_vector2(&self) -> Vector2
Do a best effort to create a Vector2
out of the variant, possibly returning a default value.
pub fn try_to_vector2(&self) -> Option<Vector2>
[src]
pub fn try_to_vector2(&self) -> Option<Vector2>
Returns Some(Vector2)
if this variant is one, None
otherwise.
pub fn to_vector3(&self) -> Vector3
[src]
pub fn to_vector3(&self) -> Vector3
Do a best effort to create a Vector3
out of the variant, possibly returning a default value.
pub fn try_to_vector3(&self) -> Option<Vector3>
[src]
pub fn try_to_vector3(&self) -> Option<Vector3>
Returns Some(Vector3)
if this variant is one, None
otherwise.
pub fn to_quat(&self) -> Quat
[src]
pub fn to_quat(&self) -> Quat
Do a best effort to create a Quat
out of the variant, possibly returning a default value.
pub fn try_to_quat(&self) -> Option<Quat>
[src]
pub fn try_to_quat(&self) -> Option<Quat>
Returns Some(Quat)
if this variant is one, None
otherwise.
pub fn to_plane(&self) -> Plane
[src]
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>
[src]
pub fn try_to_plane(&self) -> Option<Plane>
Returns Some(Plane)
if this variant is one, None
otherwise.
pub fn to_rect2(&self) -> Rect2
[src]
pub fn to_rect2(&self) -> Rect2
Do a best effort to create a Rect2
out of the variant, possibly returning a default value.
pub fn try_to_rect2(&self) -> Option<Rect2>
[src]
pub fn try_to_rect2(&self) -> Option<Rect2>
Returns Some(Rect2)
if this variant is one, None
otherwise.
pub fn to_transform(&self) -> Transform
[src]
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>
[src]
pub fn try_to_transform(&self) -> Option<Transform>
Returns Some(Transform)
if this variant is one, None
otherwise.
pub fn to_transform2d(&self) -> Transform2D
[src]
pub fn to_transform2d(&self) -> Transform2D
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>
[src]
pub fn try_to_transform2d(&self) -> Option<Transform2D>
Returns Some(Transform2D)
if this variant is one, None
otherwise.
pub fn to_basis(&self) -> Basis
[src]
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>
[src]
pub fn try_to_basis(&self) -> Option<Basis>
Returns Some(Basis)
if this variant is one, None
otherwise.
pub fn to_color(&self) -> Color
[src]
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>
[src]
pub fn try_to_color(&self) -> Option<Color>
Returns Some(Color)
if this variant is one, None
otherwise.
pub fn to_aabb(&self) -> Aabb
[src]
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>
[src]
pub fn try_to_aabb(&self) -> Option<Aabb>
Returns Some(Aabb)
if this variant is one, None
otherwise.
pub fn to_f64(&self) -> f64
[src]
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>
[src]
pub fn try_to_f64(&self) -> Option<f64>
Returns Some(f64)
if this variant is one, None
otherwise.
pub fn to_i64(&self) -> i64
[src]
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>
[src]
pub fn try_to_i64(&self) -> Option<i64>
Returns Some(i64)
if this variant is one, None
otherwise.
pub fn to_bool(&self) -> bool
[src]
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>
[src]
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
[src]
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>
[src]
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
[src]
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>
[src]
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
[src]
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>
[src]
pub fn try_to_rid(&self) -> Option<Rid>
Returns Some(Rid)
if this variant is one, None
otherwise.
pub fn to_array(&self) -> VariantArray
[src]
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>
[src]
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
[src]
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>
[src]
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
[src]
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>
[src]
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
[src]
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>
[src]
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
[src]
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>
[src]
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
[src]
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>
[src]
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
[src]
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>
[src]
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
[src]
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>
[src]
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
[src]
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>
[src]
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,
[src]
pub fn try_to_object<T>(&self) -> Option<T> where
T: GodotObject,
pub fn to_string(&self) -> String
[src]
pub fn to_string(&self) -> String
pub fn try_to_string(&self) -> Option<String>
[src]
pub fn try_to_string(&self) -> Option<String>
pub fn get_type(&self) -> VariantType
[src]
pub fn get_type(&self) -> VariantType
Returns this variant's type.
pub fn is_nil(&self) -> bool
[src]
pub fn is_nil(&self) -> bool
Returns true if this is an empty variant.
pub fn has_method(&self, method: &GodotString) -> bool
[src]
pub fn has_method(&self, method: &GodotString) -> bool
pub fn call(&mut self, method: &GodotString, args: &[Variant]) -> Result<(), ()>
[src]
pub fn call(&mut self, method: &GodotString, args: &[Variant]) -> Result<(), ()>
pub fn forget(self) -> godot_variant
[src]
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 Drop for Variant
[src]
impl Drop for Variant
impl Clone for Variant
[src]
impl Clone for Variant
fn clone(&self) -> Self
[src]
fn clone(&self) -> Self
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 PartialEq for Variant
[src]
impl PartialEq for Variant
fn eq(&self, other: &Self) -> bool
[src]
fn eq(&self, other: &Self) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Default for Variant
[src]
impl Default for Variant
impl Debug for Variant
[src]
impl Debug for Variant
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl From<i64> for Variant
[src]
impl From<i64> for Variant
impl From<u64> for Variant
[src]
impl From<u64> for Variant
impl From<bool> for Variant
[src]
impl From<bool> for Variant
impl<'l> From<&'l Vector2> for Variant
[src]
impl<'l> From<&'l Vector2> for Variant
impl<'l> From<&'l Vector3> for Variant
[src]
impl<'l> From<&'l Vector3> for Variant
impl<'l> From<&'l Quat> for Variant
[src]
impl<'l> From<&'l Quat> for Variant
impl<'l> From<&'l Plane> for Variant
[src]
impl<'l> From<&'l Plane> for Variant
impl<'l> From<&'l Rect2> for Variant
[src]
impl<'l> From<&'l Rect2> for Variant
impl<'l> From<&'l Transform> for Variant
[src]
impl<'l> From<&'l Transform> for Variant
impl<'l> From<&'l Transform2D> for Variant
[src]
impl<'l> From<&'l Transform2D> for Variant
fn from(val: &'l Transform2D) -> Variant
[src]
fn from(val: &'l Transform2D) -> Variant
Performs the conversion.
impl<'l> From<&'l Basis> for Variant
[src]
impl<'l> From<&'l Basis> for Variant
impl<'l> From<&'l Color> for Variant
[src]
impl<'l> From<&'l Color> for Variant
impl<'l> From<&'l Aabb> for Variant
[src]
impl<'l> From<&'l Aabb> for Variant
impl<'l> From<&'l String> for Variant
[src]
impl<'l> From<&'l String> for Variant
impl<'l> From<&'l Rid> for Variant
[src]
impl<'l> From<&'l Rid> for Variant
impl<'l> From<&'l NodePath> for Variant
[src]
impl<'l> From<&'l NodePath> for Variant
impl<'l> From<&'l GodotString> for Variant
[src]
impl<'l> From<&'l GodotString> for Variant
fn from(val: &'l GodotString) -> Variant
[src]
fn from(val: &'l GodotString) -> Variant
Performs the conversion.
impl<'l> From<&'l Dictionary> for Variant
[src]
impl<'l> From<&'l Dictionary> for Variant
fn from(val: &'l Dictionary) -> Variant
[src]
fn from(val: &'l Dictionary) -> Variant
Performs the conversion.
impl<'l> From<&'l VariantArray> for Variant
[src]
impl<'l> From<&'l VariantArray> for Variant
fn from(val: &'l VariantArray) -> Variant
[src]
fn from(val: &'l VariantArray) -> Variant
Performs the conversion.
impl<'l> From<&'l ByteArray> for Variant
[src]
impl<'l> From<&'l ByteArray> for Variant
impl<'l> From<&'l Int32Array> for Variant
[src]
impl<'l> From<&'l Int32Array> for Variant
fn from(val: &'l Int32Array) -> Variant
[src]
fn from(val: &'l Int32Array) -> Variant
Performs the conversion.
impl<'l> From<&'l Float32Array> for Variant
[src]
impl<'l> From<&'l Float32Array> for Variant
fn from(val: &'l Float32Array) -> Variant
[src]
fn from(val: &'l Float32Array) -> Variant
Performs the conversion.
impl<'l> From<&'l Vector2Array> for Variant
[src]
impl<'l> From<&'l Vector2Array> for Variant
fn from(val: &'l Vector2Array) -> Variant
[src]
fn from(val: &'l Vector2Array) -> Variant
Performs the conversion.
impl<'l> From<&'l Vector3Array> for Variant
[src]
impl<'l> From<&'l Vector3Array> for Variant
fn from(val: &'l Vector3Array) -> Variant
[src]
fn from(val: &'l Vector3Array) -> Variant
Performs the conversion.
impl<'l> From<&'l ColorArray> for Variant
[src]
impl<'l> From<&'l ColorArray> for Variant
fn from(val: &'l ColorArray) -> Variant
[src]
fn from(val: &'l ColorArray) -> Variant
Performs the conversion.
impl<'l> From<&'l str> for Variant
[src]
impl<'l> From<&'l str> for Variant
impl<T> From<T> for Variant where
T: GodotObject,
[src]
impl<T> From<T> for Variant where
T: GodotObject,