pub struct OnionFastMap<K: PartialEq + Eq + Hash + Clone, V> { /* private fields */ }
Expand description
Onion 高性能稀疏映射。
基于键池索引实现的稀疏键值对存储,支持高效查找与插入。 适用于参数绑定、捕获环境等虚拟机场景。 不保证键的唯一性,后插入的值可能会覆盖先前的值。
§字段
pairs
: (索引, 值) 对列表pool
: 关联的键池
Implementations§
Source§impl<K: PartialEq + Eq + Hash + Clone, V> OnionFastMap<K, V>
impl<K: PartialEq + Eq + Hash + Clone, V> OnionFastMap<K, V>
pub fn new(pool: OnionKeyPool<K>) -> Self
pub fn pool(&self) -> &OnionKeyPool<K>
pub fn new_with_pairs(pairs: Vec<(usize, V)>, pool: OnionKeyPool<K>) -> Self
pub fn push<Q>(&mut self, key: &Q, value: V) -> Option<()>
pub fn push_with_index(&mut self, index: usize, value: V) -> Option<()>
pub fn pairs(&self) -> &[(usize, V)]
pub fn set_pairs(&mut self, pairs: Vec<(usize, V)>)
pub fn clear(&mut self)
pub fn to_index<Q>(&self, key: &Q) -> Option<usize>
pub fn from_index(&self, index: usize) -> Option<&K>
pub fn get<Q>(&self, key: &Q) -> Option<&V>
pub fn get_by_index(&self, target_index: usize) -> Option<&V>
Trait Implementations§
Source§impl<K: Clone + PartialEq + Eq + Hash + Clone, V: Clone> Clone for OnionFastMap<K, V>
impl<K: Clone + PartialEq + Eq + Hash + Clone, V: Clone> Clone for OnionFastMap<K, V>
Source§fn clone(&self) -> OnionFastMap<K, V>
fn clone(&self) -> OnionFastMap<K, V>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<K, V> Freeze for OnionFastMap<K, V>
impl<K, V> RefUnwindSafe for OnionFastMap<K, V>where
V: RefUnwindSafe,
K: RefUnwindSafe,
impl<K, V> Send for OnionFastMap<K, V>
impl<K, V> Sync for OnionFastMap<K, V>
impl<K, V> Unpin for OnionFastMap<K, V>where
V: Unpin,
impl<K, V> UnwindSafe for OnionFastMap<K, V>where
K: RefUnwindSafe,
V: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more