Struct Dictionary

Source
pub struct Dictionary(/* private fields */);
Expand description

A reference-counted Dictionary of Variant key-value pairs.

Implementations§

Source§

impl Dictionary

Source

pub fn new() -> Dictionary

Creates an empty Dictionary.

Source

pub fn is_empty(&self) -> bool

Returns true if the Dictionary contains no elements.

Source

pub fn len(&self) -> i32

Returns the number of elements in the Dictionary.

Source

pub fn clear(&mut self)

Clears the Dictionary, removing all key-value pairs.

Source

pub fn contains(&self, key: &Variant) -> bool

Returns true if the Dictionary contains the specified key.

Source

pub fn contains_all(&self, keys: &VariantArray) -> bool

Returns true if the Dictionary has all of the keys in the given array.

Source

pub fn erase(&mut self, key: &Variant)

Erase a key-value pair in the Dictionary by the specified key.

Source

pub fn get(&self, key: &Variant) -> Variant

Returns a copy of the value corresponding to the key.

Source

pub fn set(&mut self, key: &Variant, val: &Variant)

Sets a value to the element corresponding to the key.

Source

pub fn get_ref(&self, key: &Variant) -> &Variant

Returns a reference to the value corresponding to the key.

Source

pub fn get_mut_ref(&mut self, key: &Variant) -> &mut Variant

Returns a mutable reference to the value corresponding to the key.

Source

pub fn to_json(&self) -> GodotString

Returns a GodotString of the Dictionary.

Source

pub fn keys(&self) -> VariantArray

Returns an array of the keys in the Dictionary.

Source

pub fn values(&self) -> VariantArray

Returns an array of the values in the Dictionary.

Source

pub fn get_next(&self, key: &Variant) -> &Variant

Source

pub fn hash(&self) -> i32

Return a hashed i32 value representing the dictionary’s contents.

Source

pub fn new_ref(&self) -> Dictionary

Trait Implementations§

Source§

impl Debug for Dictionary

Source§

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

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

impl Default for Dictionary

Source§

fn default() -> Dictionary

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

impl Drop for Dictionary

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'l> From<&'l Dictionary> for Variant

Source§

fn from(val: &'l Dictionary) -> Variant

Converts to this type from the input type.
Source§

impl PartialEq for Dictionary

Source§

fn eq(&self, other: &Dictionary) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ToVariant for Dictionary

Source§

impl Eq for Dictionary

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.