Implements IntoIterator as suggested https://github.com/cozodb/cozo/issues/207

main
Ziyang Hu 10 months ago
parent 890d2c016e
commit 4a14c98e1a

@ -136,6 +136,15 @@ pub struct NamedRows {
pub next: Option<Box<NamedRows>>,
}
impl IntoIterator for NamedRows {
type Item = Tuple;
type IntoIter = std::vec::IntoIter<Self::Item>;
fn into_iter(self) -> Self::IntoIter {
self.rows.into_iter()
}
}
impl NamedRows {
/// create a named rows with the given headers and rows
pub fn new(headers: Vec<String>, rows: Vec<Tuple>) -> Self {

Loading…
Cancel
Save