pub enum MessageRef {
Reference {
reference: String,
},
Inline(Box<Message>),
}Expand description
Reference to a message definition
Messages can be defined either inline or as references to reusable components. This enum supports both patterns, following the AsyncAPI 3.0 specification.
§Example
use asyncapi_rust_models::{MessageRef, Message};
// Reference to a component message
let ref_msg = MessageRef::Reference {
reference: "#/components/messages/ChatMessage".to_string(),
};
// Inline message definition
let inline_msg = MessageRef::Inline(Box::new(Message {
name: Some("ChatMessage".to_string()),
title: Some("Chat Message".to_string()),
summary: Some("A chat message".to_string()),
description: None,
content_type: Some("application/json".to_string()),
payload: None,
}));Variants§
Reference
Reference to component message
Points to a reusable message definition in the components section. Format: “#/components/messages/{messageName}”
Inline(Box<Message>)
Inline message definition
Embeds the message definition directly rather than referencing a component
Trait Implementations§
Source§impl Clone for MessageRef
impl Clone for MessageRef
Source§fn clone(&self) -> MessageRef
fn clone(&self) -> MessageRef
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MessageRef
impl Debug for MessageRef
Source§impl<'de> Deserialize<'de> for MessageRef
impl<'de> Deserialize<'de> for MessageRef
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MessageRef, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MessageRef, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for MessageRef
impl Serialize for MessageRef
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for MessageRef
impl RefUnwindSafe for MessageRef
impl Send for MessageRef
impl Sync for MessageRef
impl Unpin for MessageRef
impl UnwindSafe for MessageRef
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more