Embed state mod in database mod

The `Swap` struct is now database specific, no need to have a 20 lines
 module.
This commit is contained in:
Franck Royer 2020-12-23 15:30:23 +11:00
parent 59708c57e6
commit e1e8533862
No known key found for this signature in database
GPG key ID: A82ED75A8DFC50A4
7 changed files with 48 additions and 58 deletions

View file

@ -1,30 +0,0 @@
use crate::database::{Alice, Bob};
use serde::{Deserialize, Serialize};
use std::fmt::Display;
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
pub enum Swap {
Alice(Alice),
Bob(Bob),
}
impl From<Alice> for Swap {
fn from(from: Alice) -> Self {
Swap::Alice(from)
}
}
impl From<Bob> for Swap {
fn from(from: Bob) -> Self {
Swap::Bob(from)
}
}
impl Display for Swap {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Swap::Alice(alice) => Display::fmt(alice, f),
Swap::Bob(bob) => Display::fmt(bob, f),
}
}
}