Publisher

Struct Publisher 

Source
pub struct Publisher<B: Bus> { /* private fields */ }
Expand description

A publisher associated with a Channel and a Bus. Publishers allow for publishing messages with payloads of the Bus::PublishPayload type. Publishers take care of serializing the payloads before publishing.

Implementations§

Source§

impl<'p, B> Publisher<B>

Source

pub async fn publish( &self, args: B::Args, payload: &B::PublishPayload, ) -> Result<()>

Publish a message onto a direct queue with the name produced by DirectBus::queue given the passed DirectBus::Args

Source§

impl<'i, 'b, 'f, B> Publisher<B>

Source

pub async fn publish_recv_comm( &self, args: B::Args, payload: &B::InitialPayload, ) -> Result<impl Stream<Item = Delivery<BackReply<B>>>>

Publish an initial message onto the RpcCommBus, and receive the replies with with RpcCommBus::BackPayload payloads onto the returned Stream. The replies can be obtained by calling futures::StreamExt::next on the returned Stream.

Source§

impl<'r, 'p, B> Publisher<B>

Source

pub async fn publish_recv_many( &self, args: B::Args, payload: &B::PublishPayload, ) -> Result<impl Stream<Item = Delivery<Reply<B>>>>

Publish a message and await many replies. The replies can be obtained by calling StreamExt::next on the returned Stream.

Source

pub async fn publish_recv_one( &'r self, args: B::Args, payload: &B::PublishPayload, ) -> Result<impl Future<Output = Option<Delivery<Reply<B>>>>>

Publish a message and await a single reply. The reply can be obtained by awaiting the retured Future.

Source§

impl<'p, B> Publisher<B>

Source

pub async fn publish_topic( &self, routing_key: PublisherRoutingKey<B>, payload: &B::PublishPayload, ) -> Result<()>

Publish a message onto a topic on the exchange associated with the TopicBus for this Publisher with the passed PublisherRoutingKey.

Trait Implementations§

Source§

impl<B: Clone + Bus> Clone for Publisher<B>
where B::Chan: Clone,

Source§

fn clone(&self) -> Publisher<B>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<B> Freeze for Publisher<B>
where <B as Bus>::Chan: Freeze,

§

impl<B> RefUnwindSafe for Publisher<B>
where <B as Bus>::Chan: RefUnwindSafe,

§

impl<B> Send for Publisher<B>
where <B as Bus>::Chan: Send,

§

impl<B> Sync for Publisher<B>
where <B as Bus>::Chan: Sync,

§

impl<B> Unpin for Publisher<B>
where <B as Bus>::Chan: Unpin,

§

impl<B> UnwindSafe for Publisher<B>
where <B as Bus>::Chan: UnwindSafe,

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> ErasedDestructor for T
where T: 'static,