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
//! Implements the public traits that developers inherit from in order to properly utilize the
//! derive macro's functionality in code conversion and generation.

pub mod value;

use crate::value::Value;
use std::collections::{BTreeMap, HashMap};

pub trait FromHashMap: Default {
    fn from_hashmap(hashmap: HashMap<String, Value>) -> Self;
}

#[allow(clippy::wrong_self_convention)]
pub trait ToHashMap: Default {
    fn to_hashmap(structure: Self) -> HashMap<String, Value>;
}

pub trait FromBTreeMap: Default {
    fn from_btreemap(btreemap: BTreeMap<String, Value>) -> Self;
}

#[allow(clippy::wrong_self_convention)]
pub trait ToBTreeMap: Default {
    fn to_btreemap(structure: Self) -> BTreeMap<String, Value>;
}