godot_binary_serialization::types::structures

Struct GodotDictionary

Source
pub struct GodotDictionary {
    pub map: IndexMap<Box<dyn GodotVariant>, Box<dyn GodotVariant>>,
    pub byte_size: usize,
}
Expand description

A Dictionary from godot, similar to an object in javascript, it consists of key:value pairs

Fields§

§map: IndexMap<Box<dyn GodotVariant>, Box<dyn GodotVariant>>§byte_size: usize

Implementations§

Source§

impl GodotDictionary

Source

pub fn get<V>(&self, key: impl GodotVariant + 'static) -> Option<&V>
where V: GodotVariant + 'static,

Gets a value from a dictionary

Source

pub fn insert<K, V>(&mut self, key: K, value: V)
where K: GodotVariant + 'static, V: GodotVariant + 'static,

Inserst a value into a dictionary

Source

pub fn new() -> Self

Creates a dictionary that is empty

Source

pub fn new_from_map( map: IndexMap<Box<dyn GodotVariant>, Box<dyn GodotVariant>>, ) -> Self

Trait Implementations§

Source§

impl Debug for GodotDictionary

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for GodotDictionary

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl GodotVariant for GodotDictionary

Source§

fn byte_length(&self) -> usize

Describes the byte length of a variant, most primitive variants have a static byte length. However some variants like a dictionary may have dynamic sizes
Source§

fn as_any(&self) -> &dyn Any

Allows us to downcast ref a variant for use
Source§

fn variant_eq(&self, other: &dyn GodotVariant) -> bool

Checks if a variant is equal to another variant
Source§

fn bytes(&self) -> Vec<u8>

The variant as a byte vector

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.