vdaf_dispatch

Macro vdaf_dispatch 

Source
macro_rules! vdaf_dispatch {
    ($vdaf_instance:expr, (_, $Vdaf:ident, $VERIFY_KEY_LEN:ident) => $body:tt) => { ... };
    ($vdaf_instance:expr, ($vdaf:ident, $Vdaf:ident, $VERIFY_KEY_LEN:ident) => $body:tt) => { ... };
    ($vdaf_instance:expr, ($vdaf:ident, $Vdaf:ident, $VERIFY_KEY_LEN:ident, $dp_strategy:ident, $DpStrategy:ident) => $body:tt) => { ... };
}
Expand description

Emits a match block dispatching on a VdafInstance.

This must be called inside a method that returns a result, with an error type that prio::vdaf::VdafError can be converted into. Takes a &VdafInstance as the first argument, followed by a pseudo-pattern and body. The pseudo-pattern takes a variable name for the constructed VDAF, a type alias name that the block can use to explicitly specify the VDAF’s type, and the name of a const that will be set to the VDAF’s verify key length, also for explicitly specifying type parameters.

§Example:

vdaf_dispatch!(&vdaf, (vdaf, VdafType, VERIFY_KEY_LEN) => {
    handle_request_generic::<VdafType, VERIFY_KEY_LEN>(&vdaf)
})