Struct gdnative_core::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 Variantpub fn from_vector2(val: &Vector2) -> Variant[src]
pub fn from_vector2(val: &Vector2) -> VariantCreates a Variant wrapping a Vector2.
pub fn from_vector3(val: &Vector3) -> Variant[src]
pub fn from_vector3(val: &Vector3) -> VariantCreates a Variant wrapping a Vector3.
pub fn from_quat(val: &Quat) -> Variant[src]
pub fn from_quat(val: &Quat) -> VariantCreates a Variant wrapping a Quat.
pub fn from_plane(val: &Plane) -> Variant[src]
pub fn from_plane(val: &Plane) -> VariantCreates a Variant wrapping a Plane.
pub fn from_rect2(val: &Rect2) -> Variant[src]
pub fn from_rect2(val: &Rect2) -> VariantCreates a Variant wrapping a Rect2.
pub fn from_transform(val: &Transform) -> Variant[src]
pub fn from_transform(val: &Transform) -> VariantCreates a Variant wrapping a Transform.
pub fn from_transform2d(val: &Transform2D) -> Variant[src]
pub fn from_transform2d(val: &Transform2D) -> VariantCreates a Variant wrapping a Transform2D.
pub fn from_basis(val: &Basis) -> Variant[src]
pub fn from_basis(val: &Basis) -> VariantCreates a Variant wrapping a Basis.
pub fn from_color(val: &Color) -> Variant[src]
pub fn from_color(val: &Color) -> VariantCreates a Variant wrapping a Color.
pub fn from_aabb(val: &Aabb) -> Variant[src]
pub fn from_aabb(val: &Aabb) -> VariantCreates a Variant wrapping an Aabb.
pub fn from_rid(val: &Rid) -> Variant[src]
pub fn from_rid(val: &Rid) -> VariantCreates a Variant wrapping an Rid.
pub fn from_node_path(val: &NodePath) -> Variant[src]
pub fn from_node_path(val: &NodePath) -> VariantCreates a Variant wrapping a NodePath.
pub fn from_godot_string(val: &GodotString) -> Variant[src]
pub fn from_godot_string(val: &GodotString) -> VariantCreates a Variant wrapping a GodotString.
pub fn from_array(val: &VariantArray) -> Variant[src]
pub fn from_array(val: &VariantArray) -> VariantCreates an Variant wrapping an array of variants.
pub fn from_byte_array(val: &ByteArray) -> Variant[src]
pub fn from_byte_array(val: &ByteArray) -> VariantCreates a Variant wrapping a byte array.
pub fn from_int32_array(val: &Int32Array) -> Variant[src]
pub fn from_int32_array(val: &Int32Array) -> VariantCreates 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) -> VariantCreates a Variant wrapping an array of 32bit floats.
pub fn from_string_array(val: &StringArray) -> Variant[src]
pub fn from_string_array(val: &StringArray) -> VariantCreates a Variant wrapping an array of godot strings.
pub fn from_vector2_array(val: &Vector2Array) -> Variant[src]
pub fn from_vector2_array(val: &Vector2Array) -> VariantCreates a Variant wrapping an array of 2d vectors.
pub fn from_vector3_array(val: &Vector3Array) -> Variant[src]
pub fn from_vector3_array(val: &Vector3Array) -> VariantCreates a Variant wrapping an array of 3d vectors.
pub fn from_color_array(val: &ColorArray) -> Variant[src]
pub fn from_color_array(val: &ColorArray) -> VariantCreates a Variant wrapping an array of colors.
pub fn from_dictionary(val: &Dictionary) -> Variant[src]
pub fn from_dictionary(val: &Dictionary) -> VariantCreates a Variant wrapping a dictionary.
pub fn new() -> Self[src]
pub fn new() -> SelfCreates 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) -> VariantCreates a Variant wrapping a signed integer value.
pub fn from_u64(v: u64) -> Variant[src]
pub fn from_u64(v: u64) -> VariantCreates a Variant wrapping an unsigned integer value.
pub fn from_bool(v: bool) -> Variant[src]
pub fn from_bool(v: bool) -> VariantCreates a Variant wrapping an boolean.
pub fn to_vector2(&self) -> Vector2[src]
pub fn to_vector2(&self) -> Vector2Do 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) -> Vector3Do 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) -> QuatDo 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) -> PlaneDo 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) -> Rect2Do 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) -> TransformDo 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) -> Transform2DDo 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) -> BasisDo 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) -> ColorDo 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) -> AabbDo 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) -> f64Do 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) -> i64Do 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) -> boolDo 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) -> NodePathDo 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) -> GodotStringDo 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) -> RidDo 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) -> VariantArrayDo 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) -> ByteArrayDo 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) -> Int32ArrayDo 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) -> Float32ArrayDo 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) -> StringArrayDo 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) -> Vector2ArrayDo 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) -> Vector3ArrayDo 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) -> ColorArrayDo 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) -> DictionaryDo 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) -> Stringpub 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) -> VariantTypeReturns this variant's type.
pub fn is_nil(&self) -> bool[src]
pub fn is_nil(&self) -> boolReturns true if this is an empty variant.
pub fn has_method(&self, method: &GodotString) -> bool[src]
pub fn has_method(&self, method: &GodotString) -> boolpub 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_variantReturns 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 Variantimpl Clone for Variant[src]
impl Clone for Variantfn clone(&self) -> Self[src]
fn clone(&self) -> SelfReturns 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 Variantfn eq(&self, other: &Self) -> bool[src]
fn eq(&self, other: &Self) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Rhs) -> bool1.0.0[src]
fn ne(&self, other: &Rhs) -> boolThis method tests for !=.
impl Default for Variant[src]
impl Default for Variantimpl Debug for Variant[src]
impl Debug for Variantfn 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 Variantimpl From<u64> for Variant[src]
impl From<u64> for Variantimpl From<bool> for Variant[src]
impl From<bool> for Variantimpl<'l> From<&'l Vector2> for Variant[src]
impl<'l> From<&'l Vector2> for Variantimpl<'l> From<&'l Vector3> for Variant[src]
impl<'l> From<&'l Vector3> for Variantimpl<'l> From<&'l Quat> for Variant[src]
impl<'l> From<&'l Quat> for Variantimpl<'l> From<&'l Plane> for Variant[src]
impl<'l> From<&'l Plane> for Variantimpl<'l> From<&'l Rect2> for Variant[src]
impl<'l> From<&'l Rect2> for Variantimpl<'l> From<&'l Transform> for Variant[src]
impl<'l> From<&'l Transform> for Variantimpl<'l> From<&'l Transform2D> for Variant[src]
impl<'l> From<&'l Transform2D> for Variantfn from(val: &'l Transform2D) -> Variant[src]
fn from(val: &'l Transform2D) -> VariantPerforms the conversion.
impl<'l> From<&'l Basis> for Variant[src]
impl<'l> From<&'l Basis> for Variantimpl<'l> From<&'l Color> for Variant[src]
impl<'l> From<&'l Color> for Variantimpl<'l> From<&'l Aabb> for Variant[src]
impl<'l> From<&'l Aabb> for Variantimpl<'l> From<&'l String> for Variant[src]
impl<'l> From<&'l String> for Variantimpl<'l> From<&'l Rid> for Variant[src]
impl<'l> From<&'l Rid> for Variantimpl<'l> From<&'l NodePath> for Variant[src]
impl<'l> From<&'l NodePath> for Variantimpl<'l> From<&'l GodotString> for Variant[src]
impl<'l> From<&'l GodotString> for Variantfn from(val: &'l GodotString) -> Variant[src]
fn from(val: &'l GodotString) -> VariantPerforms the conversion.
impl<'l> From<&'l Dictionary> for Variant[src]
impl<'l> From<&'l Dictionary> for Variantfn from(val: &'l Dictionary) -> Variant[src]
fn from(val: &'l Dictionary) -> VariantPerforms the conversion.
impl<'l> From<&'l VariantArray> for Variant[src]
impl<'l> From<&'l VariantArray> for Variantfn from(val: &'l VariantArray) -> Variant[src]
fn from(val: &'l VariantArray) -> VariantPerforms the conversion.
impl<'l> From<&'l ByteArray> for Variant[src]
impl<'l> From<&'l ByteArray> for Variantimpl<'l> From<&'l Int32Array> for Variant[src]
impl<'l> From<&'l Int32Array> for Variantfn from(val: &'l Int32Array) -> Variant[src]
fn from(val: &'l Int32Array) -> VariantPerforms the conversion.
impl<'l> From<&'l Float32Array> for Variant[src]
impl<'l> From<&'l Float32Array> for Variantfn from(val: &'l Float32Array) -> Variant[src]
fn from(val: &'l Float32Array) -> VariantPerforms the conversion.
impl<'l> From<&'l Vector2Array> for Variant[src]
impl<'l> From<&'l Vector2Array> for Variantfn from(val: &'l Vector2Array) -> Variant[src]
fn from(val: &'l Vector2Array) -> VariantPerforms the conversion.
impl<'l> From<&'l Vector3Array> for Variant[src]
impl<'l> From<&'l Vector3Array> for Variantfn from(val: &'l Vector3Array) -> Variant[src]
fn from(val: &'l Vector3Array) -> VariantPerforms the conversion.
impl<'l> From<&'l ColorArray> for Variant[src]
impl<'l> From<&'l ColorArray> for Variantfn from(val: &'l ColorArray) -> Variant[src]
fn from(val: &'l ColorArray) -> VariantPerforms the conversion.
impl<'l> From<&'l str> for Variant[src]
impl<'l> From<&'l str> for Variantimpl<T> From<T> for Variant where
T: GodotObject, [src]
impl<T> From<T> for Variant where
T: GodotObject,