[][src]Macro anachro_client::pubsub_table

macro_rules! pubsub_table {
    (
        $enum_ty:ident,
        Subs => {
            $($sub_variant_name:ident: $sub_path:expr => $sub_variant_ty:ty,)+
        },
        Pubs => {
            $($pub_variant_name:ident: $pub_path:expr => $pub_variant_ty:ty,)+
        },
    ) => { ... };
}

A macro for defining a publish and subscribe table

This macro assists with generating a table that defines publish and subscription topics that implement the Table trait.

The first argument is the name of the table type. For "Subs" and "Pubs" sections, the format Variant Name: "pub/sub/path" => Variant Type is used. All Variant Names must be unique in the table. All Variant Types must implement serde::Serialize, serde::de::DeserializeOwned, and Clone.

All paths must be unique, and wildcard patterns must not overlap with other wildcards or fixed paths. Publish topics must not include wildcards.

Example

pubsub_table!{
    AnachroTable,
    Subs => {
        Something: "foo/bar/baz" => Demo,
        Else: "bib/bim/bap" => (),
    },
    Pubs => {
        Etwas: "short/send" => (),
        Anders: "send/short" => (),
    },
}