Skip to main content

NotificationReceiver

Struct NotificationReceiver 

Source
pub struct NotificationReceiver { /* private fields */ }
Expand description

单消费者接收权,宿主可在不销毁旧 route 的情况下关闭并排空。

Implementations§

Source§

impl NotificationReceiver

Source

pub async fn recv(&mut self) -> Option<Envelope>

业务作用:取走一条已接受消息并从等待深度中扣除。

参数说明:无。

返回:消息或已关闭且排空的 None。

Source

pub fn close(&mut self)

业务作用:关闭生产与接收入口,保留现有消息供有限排空。

参数说明:无。

返回:无;关闭后不再接受新通知。

Source

pub fn discard_remaining(&mut self) -> usize

业务作用:在停机预算耗尽时计数并释放尚未投递的消息。

参数说明:无。

返回:本次放弃的消息数。

Trait Implementations§

Source§

impl Drop for NotificationReceiver

Source§

fn drop(&mut self)

业务作用:异常退出也撤销旧路由并登记尚未消费的通知,避免悬空生产端。

参数说明:无。

返回:无;只进行有限队列清理和原子计数。

Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.