parent
b68b74ac32
commit
b83a0434a4
|
@ -1,3 +1,4 @@
|
||||||
|
use super::Versions;
|
||||||
use crate::{hash::Hash, pubkey::Pubkey};
|
use crate::{hash::Hash, pubkey::Pubkey};
|
||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
@ -33,23 +34,6 @@ impl State {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
|
||||||
pub enum Versions {
|
|
||||||
Current(Box<State>),
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Versions {
|
|
||||||
pub fn new_current(state: State) -> Self {
|
|
||||||
Self::Current(Box::new(state))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn convert_to_current(self) -> State {
|
|
||||||
match self {
|
|
||||||
Self::Current(state) => *state,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
|
@ -0,0 +1,21 @@
|
||||||
|
mod current;
|
||||||
|
pub use current::{Meta, State};
|
||||||
|
|
||||||
|
use serde_derive::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
||||||
|
pub enum Versions {
|
||||||
|
Current(Box<State>),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Versions {
|
||||||
|
pub fn new_current(state: State) -> Self {
|
||||||
|
Self::Current(Box::new(state))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn convert_to_current(self) -> State {
|
||||||
|
match self {
|
||||||
|
Self::Current(state) => *state,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue