ToAsyncApiMessage

Derive Macro ToAsyncApiMessage 

Source
#[derive(ToAsyncApiMessage)]
{
    // Attributes available to this derive:
    #[asyncapi]
}
Expand description

Derive macro for generating AsyncAPI message metadata

§Example

use asyncapi_rust::ToAsyncApiMessage;
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, ToAsyncApiMessage)]
#[serde(tag = "type")]
pub enum Message {
    #[serde(rename = "chat")]
    Chat { room: String, text: String },
    Echo { id: i64, text: String },
}