#[non_exhaustive]pub struct OutgoingMessageMetadata {
pub channel: Cow<'static, str>,
pub message_type: &'static str,
pub message_name: Option<&'static str>,
pub message_description: Option<&'static str>,
pub payload_schema: Option<String>,
pub headers_schema: Option<String>,
pub parameters: &'static [&'static str],
pub serialized: bool,
pub kind: OutgoingKind,
pub content_type: Option<&'static str>,
pub reply_address_location: Option<&'static str>,
pub bindings: PublishBindings,
}Expand description
One message a handler publishes, as declared for the AsyncAPI document.
The declaration is the reply of a reply("dest") form, one entry of an Out slot’s
#[publishes(..)] dictionary, or the destination of a dead_letter(..) declaration.
Constructed by generated code through new plus the builder-style setters;
consumed by build_spec, which renders each entry according to its kind.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.channel: Cow<'static, str>The channel / subject the message is published to.
message_type: &'static strType name of the published value, as captured at registration time.
message_name: Option<&'static str>The type’s Message name, when it implements that trait.
message_description: Option<&'static str>The type’s Message description, when it implements that trait.
payload_schema: Option<String>The type’s serialized JSON Schema, when available (asyncapi feature).
headers_schema: Option<String>The serialized JSON Schema of the type’s #[message(headers(..))] contract, when it
declares one.
parameters: &'static [&'static str]The placeholder names of a templated destination (orders.{tenant}.v1), in the order
they appear in channel. Empty for a fixed one; the generated document
turns them into the channel’s parameters block, so the declaration and the call site
cannot drift apart.
serialized: boolTrue when the type rides the serialized wire
(Serialized): its bytes are its own wire format, so the
missing payload schema is by design rather than a documentation gap.
kind: OutgoingKindWhat this entry is to its registration: a slot publish, a reply, or a dead-letter destination.
content_type: Option<&'static str>The media type the codec bound at the mount site encodes this message in
(Codec::CONTENT_TYPE). None where nothing
encodes: a Serialized reply and a dead-lettered delivery
both carry bytes that are their own wire format.
reply_address_location: Option<&'static str>The runtime expression naming where a reply of this entry actually goes, when the
registration answers per delivery: the publish policy’s
reply_address_location, carried only
where a transform on the reply position names the destination. The document then reports
the channel with address: null and puts the expression in the operation’s reply.
bindings: PublishBindingsWhat the publish policy bound on this position adds to the generated document at each level. Empty unless the broker’s policy fills it in.
Implementations§
Source§impl OutgoingMessageMetadata
impl OutgoingMessageMetadata
Sourcepub fn new(
channel: impl Into<Cow<'static, str>>,
message_type: &'static str,
) -> OutgoingMessageMetadata
pub fn new( channel: impl Into<Cow<'static, str>>, message_type: &'static str, ) -> OutgoingMessageMetadata
Constructs an entry for a message type published to channel.
Sourcepub const fn with_kind(self, kind: OutgoingKind) -> OutgoingMessageMetadata
pub const fn with_kind(self, kind: OutgoingKind) -> OutgoingMessageMetadata
Builder-style setter for what this entry is to its registration (see
kind).
Sourcepub fn with_parameters(
self,
parameters: &'static [&'static str],
) -> OutgoingMessageMetadata
pub fn with_parameters( self, parameters: &'static [&'static str], ) -> OutgoingMessageMetadata
Builder-style setter for a templated destination’s placeholder names.
Sourcepub fn with_message_name(
self,
name: Option<&'static str>,
) -> OutgoingMessageMetadata
pub fn with_message_name( self, name: Option<&'static str>, ) -> OutgoingMessageMetadata
Builder-style setter for the Message name.
Sourcepub fn with_message_description(
self,
description: Option<&'static str>,
) -> OutgoingMessageMetadata
pub fn with_message_description( self, description: Option<&'static str>, ) -> OutgoingMessageMetadata
Builder-style setter for the Message description.
Sourcepub fn with_payload_schema(
self,
schema: Option<String>,
) -> OutgoingMessageMetadata
pub fn with_payload_schema( self, schema: Option<String>, ) -> OutgoingMessageMetadata
Builder-style setter for the serialized payload schema.
Sourcepub fn with_headers_schema(
self,
schema: Option<String>,
) -> OutgoingMessageMetadata
pub fn with_headers_schema( self, schema: Option<String>, ) -> OutgoingMessageMetadata
Builder-style setter for the serialized headers schema.
Sourcepub fn with_serialized(self, serialized: bool) -> OutgoingMessageMetadata
pub fn with_serialized(self, serialized: bool) -> OutgoingMessageMetadata
Builder-style setter for the serialized-wire marker (see serialized).
Sourcepub const fn with_content_type(
self,
content_type: Option<&'static str>,
) -> OutgoingMessageMetadata
pub const fn with_content_type( self, content_type: Option<&'static str>, ) -> OutgoingMessageMetadata
Builder-style setter for the media type this message leaves in (see
content_type).
§Examples
use ruststream::runtime::OutgoingMessageMetadata;
let entry = OutgoingMessageMetadata::new("events.progress", "Progress")
.with_content_type(Some("application/json"));
assert_eq!(entry.content_type, Some("application/json"));Trait Implementations§
Source§impl Clone for OutgoingMessageMetadata
impl Clone for OutgoingMessageMetadata
Source§fn clone(&self) -> OutgoingMessageMetadata
fn clone(&self) -> OutgoingMessageMetadata
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for OutgoingMessageMetadata
impl RefUnwindSafe for OutgoingMessageMetadata
impl Send for OutgoingMessageMetadata
impl Sync for OutgoingMessageMetadata
impl Unpin for OutgoingMessageMetadata
impl UnsafeUnpin for OutgoingMessageMetadata
impl UnwindSafe for OutgoingMessageMetadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more