Skip to main content

with_deep_view_and_mapper

Macro with_deep_view_and_mapper 

Source
macro_rules! with_deep_view_and_mapper {
    (
        $(#[$exec_attr:meta])*
        pub struct $exec_name:ident <$lt:lifetime> {
            $(pub $exec_field:ident: $exec_ty:ty,)*
        }

        $(#[$spec_attr:meta])*
        pub struct $spec_name:ident {
            $(pub $spec_field:ident: $spec_ty:ty,)*
        }

        type $inner_name:ident;
        pub struct $mapper_name:ident;
    ) => { ... };
    (
        $(#[$exec_attr:meta])*
        pub enum $exec_name:ident <$lt:lifetime> {
            $($exec_variant:ident($exec_ty:ty),)*
        }

        $(#[$spec_attr:meta])*
        pub enum $spec_name:ident {
            $($spec_variant:ident($spec_ty:ty),)*
        }

        type $inner_name:ident;
        pub struct $mapper_name:ident;
    ) => { ... };
}
Expand description

Defines paired executable/spec nominal value types and corresponding DeepView and SpecMapper impls.

The generated DeepView and SpecMapper implementations assume the exec and spec fields or variants are aligned by name and order.