Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Implement `IntoIterator` for our OOM-handling `Vec` (#12472)

Nick Fitzgerald7b929e7f4071
diff --git a/crates/core/src/alloc/vec.rs b/crates/core/src/alloc/vec.rs
index 7bd09ede7a..12b13d694c 100644
--- a/crates/core/src/alloc/vec.rs
+++ b/crates/core/src/alloc/vec.rs
@@ -143,6 +143,15 @@ impl<T> IndexMut<usize> for Vec<T> {
}
}
+impl<T> IntoIterator for Vec<T> {
+ type Item = T;
+ type IntoIter = std_alloc::vec::IntoIter<T>;
+
+ fn into_iter(self) -> Self::IntoIter {
+ self.inner.into_iter()
+ }
+}
+
impl<'a, T> IntoIterator for &'a Vec<T> {
type Item = &'a T;