#[non_exhaustive]pub struct ReplyAddress {
pub location: String,
}Expand description
Where a client finds the address a reply is published to: the AsyncAPI operation reply
address object.
Filled from the publish policy’s
reply_address_location, which a broker
answers with the header carrying the address ($message.header#/reply-to).
§Examples
use ruststream::asyncapi::Spec;
/// Where a client generator finds the address to read an operation's reply from.
fn reply_location<'a>(spec: &'a Spec, operation: &str) -> Option<&'a str> {
let reply = spec.operations.get(operation)?.reply.as_ref()?;
reply
.address
.as_ref()
.map(|address| address.location.as_str())
}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.location: StringThe runtime expression naming the address, per the specification’s grammar.
Implementations§
Source§impl ReplyAddress
impl ReplyAddress
Sourcepub fn new(location: impl Into<String>) -> Self
pub fn new(location: impl Into<String>) -> Self
The address a reply is published to, as a runtime expression.
§Examples
use ruststream::asyncapi::{ReplyAddress, Spec};
/// The gateway in front of the service answers on the inbox a request names, which the
/// broker underneath cannot say, so the published document is completed here.
fn add_gateway_reply(spec: &mut Spec) {
if let Some(reply) = spec
.operations
.get_mut("receive_requests")
.and_then(|operation| operation.reply.as_mut())
{
reply.address = Some(ReplyAddress::new("$message.header#/reply-to"));
}
}Trait Implementations§
Source§impl Clone for ReplyAddress
impl Clone for ReplyAddress
Source§impl Debug for ReplyAddress
impl Debug for ReplyAddress
Auto Trait Implementations§
impl Freeze for ReplyAddress
impl RefUnwindSafe for ReplyAddress
impl Send for ReplyAddress
impl Sync for ReplyAddress
impl Unpin for ReplyAddress
impl UnsafeUnpin for ReplyAddress
impl UnwindSafe for ReplyAddress
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> ⓘ
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 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> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> MessageWire for Twhere
T: Serialize,
impl<T> MessageWire for Twhere
T: Serialize,
Source§type Wire = EncodedWire
type Wire = EncodedWire
The value’s wire:
EncodedWire or SerializedWire.impl<T> PublishedThrough<DefaultSlot> for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R> ReplyShape for R
impl<R> ReplyShape for R
type Body = R
type Headers = ()
Source§type Wire = EncodedReply
type Wire = EncodedReply
The reply’s wire:
EncodedReply or SerializedReply.