json_placeholder_data/
lib.rs

1pub mod albums;
2pub mod comments;
3pub mod photos;
4pub mod posts;
5pub mod todos;
6pub mod users;
7
8pub const PLACEHOLDER_BASE: &str = "https://jsonplaceholder.typicode.com/";
9
10
11macro_rules! from_json {
12    ($data:expr) => {
13        serde_json::from_str($data).unwrap()
14    };
15}
16pub(crate) use from_json;
17    
18macro_rules! by_id {
19    ($id:expr) => {
20        get_all()
21            .into_iter()
22            .filter(|data| data.id == Some($id))
23            .last()
24            .unwrap()
25    };
26}    
27pub(crate) use by_id;