Macro ports

Source
ports!() { /* proc-macro */ }
Expand description

§Macros for generating parser of arguments block requires.

§Example

ports! {
    #[block_names(block_name1, block_name2)]
    pub struct Ports {
        // parameter `a` has minimum size of 1 and unbouded maximum size, required
        a: In 1,
        // parameter `y` should have exactly 1 size, optional
        y: InOut 1 1 ?,
        // parameter `b` has minimum size of 2 and maximum size of 10, required
        b: Out 2 10,
    }
}

Resulting struct would have fields with types from those:

GetSingleOptional

GetSingle

GetMultipleOptional

GetMultiple

SetSingleOptional

SetSingle

SetMultipleOptional

SetMultiple

GetSetSingleOptional

GetSetSingle

GetSetMultipleOptional

GetSetMultiple