godot::prelude

Trait Var

pub trait Var: GodotConvert {
    // Required methods
    fn get_property(&self) -> Self::Via;
    fn set_property(&mut self, value: Self::Via);

    // Provided method
    fn var_hint() -> PropertyHintInfo { ... }
}
Expand description

Trait implemented for types that can be used as #[var] fields.

This creates a copy of the value, according to copy semantics provided by Clone. For example, Array, Dictionary and Gd are returned by shared reference instead of copying the actual data.

This does not require FromGodot or ToGodot, so that something can be used as a property even if it can’t be used in function arguments/return types.

Required Methods§

fn get_property(&self) -> Self::Via

fn set_property(&mut self, value: Self::Via)

Provided Methods§

fn var_hint() -> PropertyHintInfo

Specific property hints, only override if they deviate from GodotType::property_info, e.g. for enums/newtypes.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

§

impl Var for bool

§

fn get_property(&self) -> <bool as GodotConvert>::Via

§

fn set_property(&mut self, value: <bool as GodotConvert>::Via)

§

impl Var for f32

§

fn get_property(&self) -> <f32 as GodotConvert>::Via

§

fn set_property(&mut self, value: <f32 as GodotConvert>::Via)

§

impl Var for f64

§

fn get_property(&self) -> <f64 as GodotConvert>::Via

§

fn set_property(&mut self, value: <f64 as GodotConvert>::Via)

§

impl Var for i8

§

fn get_property(&self) -> <i8 as GodotConvert>::Via

§

fn set_property(&mut self, value: <i8 as GodotConvert>::Via)

§

impl Var for i16

§

fn get_property(&self) -> <i16 as GodotConvert>::Via

§

fn set_property(&mut self, value: <i16 as GodotConvert>::Via)

§

impl Var for i32

§

fn get_property(&self) -> <i32 as GodotConvert>::Via

§

fn set_property(&mut self, value: <i32 as GodotConvert>::Via)

§

impl Var for i64

§

fn get_property(&self) -> <i64 as GodotConvert>::Via

§

fn set_property(&mut self, value: <i64 as GodotConvert>::Via)

§

impl Var for u8

§

fn get_property(&self) -> <u8 as GodotConvert>::Via

§

fn set_property(&mut self, value: <u8 as GodotConvert>::Via)

§

impl Var for u16

§

fn get_property(&self) -> <u16 as GodotConvert>::Via

§

fn set_property(&mut self, value: <u16 as GodotConvert>::Via)

§

impl Var for u32

§

fn get_property(&self) -> <u32 as GodotConvert>::Via

§

fn set_property(&mut self, value: <u32 as GodotConvert>::Via)

§

impl<T> Var for Option<T>
where T: Var + FromGodot, Option<T>: GodotConvert<Via = Option<<T as GodotConvert>::Via>>,

§

fn get_property(&self) -> <Option<T> as GodotConvert>::Via

§

fn set_property(&mut self, value: <Option<T> as GodotConvert>::Via)

Implementors§

§

impl Var for Rid

§

impl Var for Aabb

§

impl Var for Basis

§

impl Var for Callable

§

impl Var for Color

§

impl Var for Dictionary

§

impl Var for GString

§

impl Var for NodePath

§

impl Var for PackedByteArray

§

impl Var for PackedColorArray

§

impl Var for PackedFloat32Array

§

impl Var for PackedFloat64Array

§

impl Var for PackedInt32Array

§

impl Var for PackedInt64Array

§

impl Var for PackedStringArray

§

impl Var for PackedVector2Array

§

impl Var for PackedVector3Array

§

impl Var for PackedVector4Array

§

impl Var for Plane

§

impl Var for Projection

§

impl Var for Quaternion

§

impl Var for Rect2

§

impl Var for Rect2i

§

impl Var for Signal

§

impl Var for StringName

§

impl Var for Transform2D

§

impl Var for Transform3D

§

impl Var for Variant

§

impl Var for Vector2

§

impl Var for Vector2i

§

impl Var for Vector3

§

impl Var for Vector3i

§

impl Var for Vector4

§

impl Var for Vector4i

§

impl<T> Var for Array<T>
where T: ArrayElement,

§

impl<T> Var for Gd<T>
where T: GodotClass,

§

impl<T> Var for OnReady<T>
where T: Var,