azure_storage/
macros.rs

1/// create a "response" struct of a certain name, containing certain headers.
2#[macro_export]
3macro_rules! response_from_headers {
4    ($cn:ident, $($fh:path => $na:ident: $typ:ty),+) => {
5        use azure_core::headers::Headers;
6
7        #[derive(Debug, Clone, PartialEq, Eq)]
8        pub struct $cn {
9             $(pub $na: $typ),+,
10        }
11
12        impl $cn {
13            pub(crate) fn from_headers(headers: &Headers) -> Result<$cn, $crate::Error> {
14               $(
15                    let $na = $fh(headers)?;
16                )+
17
18                Ok($cn {
19                    $($na,)+
20                })
21            }
22
23        }
24    };
25}