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
36
37
mod host;
mod host_funcs;
mod locator;
mod virtual_path;

pub use anyhow::anyhow;
pub use host::*;
pub use host_funcs::*;
pub use locator::*;
pub use virtual_path::*;

/// Wrap a struct with common derives and serde required attributes.
#[macro_export]
macro_rules! api_struct {
    ($struct:item) => {
        #[derive(Clone, Debug, Default, serde::Deserialize, PartialEq, serde::Serialize)]
        #[serde(default)]
        $struct
    };
}

/// Wrap an enum with common derives and serde required attributes.
#[macro_export]
macro_rules! api_enum {
    ($struct:item) => {
        #[derive(Clone, Debug, serde::Deserialize, PartialEq, serde::Serialize)]
        $struct
    };
}

api_struct!(
    /// Represents an empty input.
    pub struct EmptyInput {}
);

/// Represents any result (using `anyhow`).
pub type AnyResult<T> = anyhow::Result<T>;