1pub use cha_plugin_sdk_macros::plugin;
27
28#[cfg(feature = "test-utils")]
29mod test_utils_impl;
30#[cfg(feature = "test-utils")]
31pub use test_utils_impl::test_utils;
32
33#[macro_export]
35macro_rules! option_str {
36 ($options:expr, $key:expr) => {
37 $options.iter().find_map(|(k, v)| match v {
38 OptionValue::Str(s) if k == $key => Some(s.as_str()),
39 _ => None,
40 })
41 };
42}
43
44#[macro_export]
46macro_rules! option_int {
47 ($options:expr, $key:expr) => {
48 $options.iter().find_map(|(k, v)| match v {
49 OptionValue::Int(n) if k == $key => Some(*n),
50 _ => None,
51 })
52 };
53}
54
55#[macro_export]
57macro_rules! option_float {
58 ($options:expr, $key:expr) => {
59 $options.iter().find_map(|(k, v)| match v {
60 OptionValue::Float(n) if k == $key => Some(*n),
61 _ => None,
62 })
63 };
64}
65
66#[macro_export]
68macro_rules! option_bool {
69 ($options:expr, $key:expr) => {
70 $options.iter().find_map(|(k, v)| match v {
71 OptionValue::Boolean(b) if k == $key => Some(*b),
72 _ => None,
73 })
74 };
75}
76
77#[macro_export]
79macro_rules! option_list_str {
80 ($options:expr, $key:expr) => {
81 $options.iter().find_map(|(k, v)| match v {
82 OptionValue::ListStr(l) if k == $key => Some(l.as_slice()),
83 _ => None,
84 })
85 };
86}
87
88#[macro_export]
90macro_rules! str_options {
91 ($options:expr) => {
92 $options.iter().filter_map(|(k, v)| match v {
93 OptionValue::Str(s) => Some((k.as_str(), s.as_str())),
94 _ => None,
95 })
96 };
97}