mirror of
https://github.com/guilhermewerner/reflection
synced 2025-06-16 13:34:19 +00:00
29 lines
521 B
Rust
29 lines
521 B
Rust
use crate::*;
|
|
use std::collections::HashMap as InnerHashMap;
|
|
use std::hash::Hash;
|
|
|
|
#[derive(Reflect)]
|
|
pub struct HashMap<K, V>
|
|
where
|
|
K: Reflect + Eq + Hash,
|
|
V: Reflect,
|
|
{
|
|
inner: InnerHashMap<K, V>,
|
|
}
|
|
|
|
impl<K, V> HashMap<K, V>
|
|
where
|
|
K: Reflect + Eq + Hash,
|
|
V: Reflect,
|
|
{
|
|
#[function]
|
|
pub fn Insert(&mut self, key: K, value: V) -> Option<V> {
|
|
self.inner.insert(key, value)
|
|
}
|
|
|
|
#[function]
|
|
pub fn Remove(&mut self, key: &K) -> Option<V> {
|
|
self.inner.remove(key)
|
|
}
|
|
}
|