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
/// shared `into` to elvis widgets
#[macro_export]
macro_rules! into {
    {$(($widget:ident, $target:ident),)*} => {
        $(
            impl Into<$target> for $widget {
                fn into(self) -> $target {
                    self.0
                }
            }
        )*
    };
}

/// shared `deref` to elvis widgets
#[macro_export]
macro_rules! deref {
    ($name: ident, $target: ident) => {
        impl Deref for $name {
            type Target = $target;

            fn deref(&self) -> &Self::Target {
                &self.0
            }
        }

        impl DerefMut for $name {
            fn deref_mut(&mut self) -> &mut Self::Target {
                &mut self.0
            }
        }
    };
}