mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
Implement serde for VecMap
This commit is contained in:
parent
a5dbdf0b02
commit
e880c45c8b
2 changed files with 87 additions and 11 deletions
|
@ -25,6 +25,14 @@ impl<K, V> VecMap<K, V> {
|
|||
|
||||
(k, v)
|
||||
}
|
||||
|
||||
pub fn unzip(self) -> (Vec<K>, Vec<V>) {
|
||||
(self.keys, self.values)
|
||||
}
|
||||
|
||||
pub fn unzip_slices(&self) -> (&[K], &[V]) {
|
||||
(&self.keys, &self.values)
|
||||
}
|
||||
}
|
||||
|
||||
impl<K: PartialEq, V> VecMap<K, V> {
|
||||
|
@ -114,14 +122,6 @@ impl<K: PartialEq, V> VecMap<K, V> {
|
|||
self.values.truncate(len);
|
||||
}
|
||||
|
||||
pub fn unzip(self) -> (Vec<K>, Vec<V>) {
|
||||
(self.keys, self.values)
|
||||
}
|
||||
|
||||
pub fn unzip_slices(&self) -> (&[K], &[V]) {
|
||||
(&self.keys, &self.values)
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
/// keys and values must have the same length, and there must not
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue