Skip to main content

OutgoingMessageMetadata

Struct OutgoingMessageMetadata 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional 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 str

Type 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: bool

True 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: OutgoingKind

What 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: PublishBindings

What 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

Source

pub fn new( channel: impl Into<Cow<'static, str>>, message_type: &'static str, ) -> OutgoingMessageMetadata

Constructs an entry for a message type published to channel.

Source

pub const fn with_kind(self, kind: OutgoingKind) -> OutgoingMessageMetadata

Builder-style setter for what this entry is to its registration (see kind).

Source

pub fn with_parameters( self, parameters: &'static [&'static str], ) -> OutgoingMessageMetadata

Builder-style setter for a templated destination’s placeholder names.

Source

pub fn with_message_name( self, name: Option<&'static str>, ) -> OutgoingMessageMetadata

Builder-style setter for the Message name.

Source

pub fn with_message_description( self, description: Option<&'static str>, ) -> OutgoingMessageMetadata

Builder-style setter for the Message description.

Source

pub fn with_payload_schema( self, schema: Option<String>, ) -> OutgoingMessageMetadata

Builder-style setter for the serialized payload schema.

Source

pub fn with_headers_schema( self, schema: Option<String>, ) -> OutgoingMessageMetadata

Builder-style setter for the serialized headers schema.

Source

pub fn with_serialized(self, serialized: bool) -> OutgoingMessageMetadata

Builder-style setter for the serialized-wire marker (see serialized).

Source

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

Source§

fn clone(&self) -> OutgoingMessageMetadata

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OutgoingMessageMetadata

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

impl<T> Identity for T
where T: ?Sized,

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> PublishedThrough<DefaultSlot> for T

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more