refactor: impl intoIterator for ColumnsByName

Allows the ColumnsByName to be converted into an iterator yielding owned
column names & schema.
pull/24376/head
Dom Dwyer 2023-05-15 12:30:11 +02:00
parent 6257918d4c
commit 160628a7f8
No known key found for this signature in database
GPG Key ID: E4C40DBD9157879A
1 changed files with 9 additions and 0 deletions

View File

@ -110,6 +110,15 @@ impl ColumnsByName {
}
}
impl IntoIterator for ColumnsByName {
type Item = (String, ColumnSchema);
type IntoIter = std::collections::btree_map::IntoIter<String, ColumnSchema>;
fn into_iter(self) -> Self::IntoIter {
self.0.into_iter()
}
}
// ColumnsByName is a newtype so that we can implement this `TryFrom` in this crate
impl TryFrom<ColumnsByName> for Schema {
type Error = schema::builder::Error;