Add some conveniences for migration
This commit is contained in:
parent
070276a2f5
commit
6cc08354b5
1 changed files with 10 additions and 0 deletions
10
src/lib.rs
10
src/lib.rs
|
|
@ -10,6 +10,8 @@ use std::io::{Read, Write};
|
||||||
use crate::error::Error;
|
use crate::error::Error;
|
||||||
use crate::io::read_magic;
|
use crate::io::read_magic;
|
||||||
|
|
||||||
|
pub use v6 as latest;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum BlotterFile {
|
pub enum BlotterFile {
|
||||||
V5(v5::BlotterFile),
|
V5(v5::BlotterFile),
|
||||||
|
|
@ -33,4 +35,12 @@ impl BlotterFile {
|
||||||
Self::V6(file) => file.write(writer),
|
Self::V6(file) => file.write(writer),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Convert the file into the latest version.
|
||||||
|
pub fn migrate(self) -> latest::BlotterFile {
|
||||||
|
match self {
|
||||||
|
Self::V5(file) => Self::V6(file.into()).migrate(),
|
||||||
|
Self::V6(file) => file,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue