Build Directory FromIterator
This enables a test for the encoder's DirectoryOffset but it seems to fit nicely with the current design, too.
This commit is contained in:
1 parent
73f066c09d
commit
eb6275547d
4 files changed
+75
-3
No files matched your search
@@ -140,6 +140,14 @@ impl fmt::Debug for Directory {
|
||||
}
|
||||
}
|
||||
|
||||
impl core::iter::FromIterator<(Tag, Entry)> for Directory {
|
||||
fn from_iter<T: IntoIterator<Item = (Tag, Entry)>>(iter: T) -> Self {
|
||||
let mut dir = Directory::empty();
|
||||
dir.extend(iter);
|
||||
dir
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::Directory;
|
||||
|
||||
Reference in new issue
Block a user