smart_hash/
lib.rs

1pub mod traits;
2
3#[cfg(feature = "derive")]
4extern crate smart_hash_derive; 
5#[cfg(feature = "derive")]
6pub use smart_hash_derive::SmartHash as SmartHash;
7
8#[macro_export]
9macro_rules! get_matching {
10
11    // basic initial format
12    // get_matching!(object, key, var, key2, var2);
13    ($obj:ident,$($key:ident,$val:expr),+) => ({
14            let mut empty_opt = $obj.get_none_default();
15            
16            $(empty_opt.$key = Some($val);)*
17
18            $obj.get_matching(empty_opt)
19    });
20
21    // more obvious what is going on in this format
22    // get_matching!(object, key == var, key2 == var2);
23    ($obj:ident,$($key:ident == $val:expr),+) => ({            
24        get_matching!($obj,$($key,$val),+)
25    });
26
27    // a more of a query format
28    // get_matching!(object where key is var, key2 is var2);
29    ($obj:ident where $($key:ident is $val:expr),+) => ({
30        get_matching!($obj,$($key,$val),+)
31    });
32}