pub fn import(
        &self,
        export: Vec<(
            CollectionType,
            CollectionName,
            impl Iterator<Item = Vec<Vec<u8>>>,
        )>,
    ) {
        for (collection_type, collection_name, collection_iter) in export {
            match collection_type {
                ref t if t == b"tree" => {
                    let tree = self
                        .open_tree(collection_name)
                        .expect("failed to open new tree during import");
                    for mut kv in collection_iter {
                        let v = kv
                            .pop()
                            .expect("failed to get value from tree export");
                        let k = kv
                            .pop()
                            .expect("failed to get key from tree export");
                        let old = tree.insert(k, v).expect(
                            "failed to insert value during tree import",
                        );
                        assert!(
                            old.is_none(),
                            "import is overwriting existing data"
                        );
                    }
                }
                other => panic!("unknown collection type {:?}", other),
            }
        }
    }
Imports the collections from a previous database.

# Panics

Panics if any IO problems occur while trying
to perform the import.

# Examples

If you want to migrate from one version of sled
to another, you need to pull in both versions
by using version renaming:

`Cargo.toml`:

```toml
[dependencies]
sled = "0.32"
old_sled = { version = "0.31", package = "sled" }
```

and in your code, remember that old versions of
sled might have a different way to open them
than the current `sled::open` method:

```
# use sled as old_sled;
# fn main() -> Result<(), Box<dyn std::error::Error>> {
let old = old_sled::open("my_old_db_import")?;

// may be a different version of sled,
// the export type is version agnostic.
let new = sled::open("my_new_db_import")?;

let export = old.export();
new.import(export);

assert_eq!(old.checksum()?, new.checksum()?);
# drop(old);
# drop(new);
# let _ = std::fs::remove_dir_all("my_old_db_import");
# let _ = std::fs::remove_dir_all("my_new_db_import");
# Ok(()) }
```
src/db.rs