Skip to content

Commit 3917c41

Browse files
committed
Added From<ZendHashTable> impl for Vec
1 parent 75f99c6 commit 3917c41

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/php/types/array.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,16 @@ where
323323
}
324324
}
325325

326+
/// Implementation for converting a `ZendHashTable` into a `Vec` of given type.
327+
impl<'a, V> From<ZendHashTable> for Vec<V>
328+
where
329+
V: From<Zval>,
330+
{
331+
fn from(ht: ZendHashTable) -> Self {
332+
ht.into_iter().map(|(_, _, v)| v.into()).collect()
333+
}
334+
}
335+
326336
/// Implementation for converting a Rust Vec into a ZendHashTable.
327337
impl<'a, V> From<Vec<V>> for ZendHashTable
328338
where

0 commit comments

Comments
 (0)