pub trait Maplike {
type Key: ToJSValConvertible;
type Value: ToJSValConvertible;
// Required methods
fn get_index(&self, index: u32) -> Option<(Self::Key, Self::Value)>;
fn get(&self, key: Self::Key) -> Option<Self::Value>;
fn size(&self) -> u32;
fn set(&self, key: Self::Key, value: Self::Value);
fn has(&self, key: Self::Key) -> bool;
fn clear(&self);
fn delete(&self, key: Self::Key) -> bool;
}
Expand description
Every Maplike dom_struct must implement this to provide access to underlying storage so codegen can automatically generate all maplike methods
In case you use a type that implements Maplike as underlying storage it’s recommended to use maplike
macro.
Required Associated Types§
sourcetype Key: ToJSValConvertible
type Key: ToJSValConvertible
The type of the key of the map.
sourcetype Value: ToJSValConvertible
type Value: ToJSValConvertible
The type of the value of the map.