Macro devices::multi_dispatch
source · macro_rules! multi_dispatch { ($self:ident, $enum:ident, $($types:ident )+, $func:ident) => { ... }; ($self:ident, $enum:ident, $($types:ident )+, $func:ident, $param:expr) => { ... }; ($self:ident, $enum:ident, $($types:ident )+, $func:ident, $param1:expr, $param2: expr) => { ... }; ($self:ident, $enum:ident, $($types:ident )+, $func:ident, $param1:expr, $param2: expr, $param3: expr) => { ... }; }
Expand description
Allows dispatching a function call to all its enum value implementations.
See BackendDeviceType
in usb/backend/device.rs for an example usage of it.
§Arguments
self
- Replacement for the localself
reference in the function call.enum
- Enum name that the macro is matching on.types
- Space-separated list of value types of the given enum.func
- Function name that will be called by each match arm.param
- Optional parameters needed for the given function call.