Skip to main content

HashMapInstance

Trait HashMapInstance 

Source
pub trait HashMapInstance<'s>: Instance<'s> + 's {
    // Required methods
    fn get_value<'a>(&'a self, key: &str) -> Option<Value<'a, 's>>
       where 's: 'a;
    fn is_empty(&self) -> bool;
    fn len(&self) -> usize;
    fn boxed_clone(&self) -> Box<dyn HashMapInstance<'s> + 's>;
    fn update<'a>(
        &'a mut self,
        update: &'a (dyn HashMapInstance<'s> + 's),
        field_mask: Option<&FieldMask>,
        replace_repeated: bool,
    ) -> Result<(), Error>;
    fn values<'a>(&'a self) -> HashMap<String, CowValue<'a, 's>>
       where 's: 'a;
    fn hashmap_eq(&self, inst: &(dyn HashMapInstance<'s> + 's)) -> bool;
    fn into_boxed_instance(self: Box<Self>) -> Box<dyn Instance<'s> + 's>;

    // Provided method
    fn contains(&self, sub_inst: &(dyn HashMapInstance<'s> + 's)) -> bool { ... }
}
Expand description

A reflected HashMap

Required Methods§

Source

fn get_value<'a>(&'a self, key: &str) -> Option<Value<'a, 's>>
where 's: 'a,

Source

fn is_empty(&self) -> bool

Source

fn len(&self) -> usize

Source

fn boxed_clone(&self) -> Box<dyn HashMapInstance<'s> + 's>

Returns a clone of the instance in a Box.

Source

fn update<'a>( &'a mut self, update: &'a (dyn HashMapInstance<'s> + 's), field_mask: Option<&FieldMask>, replace_repeated: bool, ) -> Result<(), Error>

Updates an instance based on the instance passed in. If a field mask is specified only the fields passed with the mask will be updated.

Source

fn values<'a>(&'a self) -> HashMap<String, CowValue<'a, 's>>
where 's: 'a,

Returns a HashMap containing all the attributes of the instance.

Source

fn hashmap_eq(&self, inst: &(dyn HashMapInstance<'s> + 's)) -> bool

Source

fn into_boxed_instance(self: Box<Self>) -> Box<dyn Instance<'s> + 's>

Provided Methods§

Source

fn contains(&self, sub_inst: &(dyn HashMapInstance<'s> + 's)) -> bool

Trait Implementations§

Source§

impl<'s> Clone for Box<dyn HashMapInstance<'s> + 's>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'s> Debug for dyn HashMapInstance<'s> + 's

Source§

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

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

impl<'s> PartialEq for dyn HashMapInstance<'s> + 's

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'s, T> HashMapInstance<'s> for HashMap<String, T>
where T: Typed<'s> + Clone + 's + PartialEq,

Source§

fn get_value<'a>(&'a self, key: &str) -> Option<Value<'a, 's>>
where 's: 'a,

Source§

fn update<'a>( &'a mut self, update: &'a (dyn HashMapInstance<'s> + 's), field_mask: Option<&FieldMask>, replace_repeated: bool, ) -> Result<(), Error>

Source§

fn values<'a>(&'a self) -> HashMap<String, CowValue<'a, 's>>
where 's: 'a,

Source§

fn boxed_clone(&self) -> Box<dyn HashMapInstance<'s> + 's>

Source§

fn is_empty(&self) -> bool

Source§

fn len(&self) -> usize

Source§

fn hashmap_eq(&self, inst: &(dyn HashMapInstance<'s> + 's)) -> bool

Source§

fn contains(&self, sub_inst: &(dyn HashMapInstance<'s> + 's)) -> bool

Source§

fn into_boxed_instance(self: Box<Self>) -> Box<dyn Instance<'s> + 's>

Implementors§