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.
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
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".