add http-client
This commit is contained in:
parent
ac2904588c
commit
8bcd555d71
36 changed files with 1978 additions and 49 deletions
32
http-lib/src/json_account.rs
Normal file
32
http-lib/src/json_account.rs
Normal file
|
@ -0,0 +1,32 @@
|
|||
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<JsonAccount> for Account {
|
||||
fn from(a: JsonAccount) -> Self {
|
||||
Account {
|
||||
number: a.number.clone(),
|
||||
owner: a.owner.clone(),
|
||||
balance: a.balance,
|
||||
is_active: a.is_active,
|
||||
}
|
||||
}
|
||||
}
|
1
http-lib/src/lib.rs
Normal file
1
http-lib/src/lib.rs
Normal file
|
@ -0,0 +1 @@
|
|||
pub mod json_account;
|
Loading…
Add table
Add a link
Reference in a new issue