blob: 33d6b38ae1b12201fddb766cce2b5a57592fda6f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
//! A library that provides basic building blocks of k-office tools
pub mod cass;
mod client;
pub use client::*;
mod invoice;
pub use invoice::*;
mod proj;
pub use proj::*;
mod store;
pub use store::*;
use serde::{de::DeserializeOwned, Serialize};
pub trait Io {
fn to_yaml(&self) -> String;
fn from_yaml(s: impl Into<String>) -> Self;
}
impl<T> Io for T
where
T: Serialize + DeserializeOwned,
{
fn to_yaml(&self) -> String {
serde_yaml::to_string(self).unwrap()
}
fn from_yaml(s: impl Into<String>) -> Self {
serde_yaml::from_str(s.into().as_str()).unwrap()
}
}
|