use bank::account::Account; use serde::{Deserialize, Serialize}; #[derive(Deserialize, Serialize, Debug, Clone)] pub struct JsonAccount { pub number: String, pub owner: String, pub balance: f64, pub is_active: bool, } impl From<&Account> for JsonAccount { fn from(a: &Account) -> Self { JsonAccount { number: a.number.clone(), owner: a.owner.clone(), balance: a.balance, is_active: a.is_active, } } } impl From for Account { fn from(a: JsonAccount) -> Self { Account { number: a.number.clone(), owner: a.owner.clone(), balance: a.balance, is_active: a.is_active, } } }