pub struct ActionEventPublisher { /* private fields */ }Expand description
行動イベント配信システム
broadcast channel で ActionEvent を配信。 Subscriber パターンでオンライン統計・永続化を分離。
Implementations§
Source§impl ActionEventPublisher
impl ActionEventPublisher
Sourcepub fn new(capacity: usize) -> (Self, Receiver<ActionEvent>)
pub fn new(capacity: usize) -> (Self, Receiver<ActionEvent>)
Sourcepub fn publish(&self, event: ActionEvent)
pub fn publish(&self, event: ActionEvent)
イベントを配信
全ての Subscriber に配信される。 Subscriber がいない場合は何もしない(エラーにならない)。
Sourcepub fn publish_batch(&self, events: impl IntoIterator<Item = ActionEvent>)
pub fn publish_batch(&self, events: impl IntoIterator<Item = ActionEvent>)
複数イベントを一括配信
Sourcepub fn subscribe(&self) -> Receiver<ActionEvent>
pub fn subscribe(&self) -> Receiver<ActionEvent>
追加の Receiver を取得
Sourcepub fn sender(&self) -> Sender<ActionEvent>
pub fn sender(&self) -> Sender<ActionEvent>
Sender を取得
Sourcepub fn subscriber_count(&self) -> usize
pub fn subscriber_count(&self) -> usize
現在の Subscriber 数
Sourcepub fn record(&self, event: ActionEvent)
pub fn record(&self, event: ActionEvent)
record() の別名(後方互換)
Sourcepub fn record_batch(&self, events: impl IntoIterator<Item = ActionEvent>)
pub fn record_batch(&self, events: impl IntoIterator<Item = ActionEvent>)
record_batch() の別名(後方互換)
Auto Trait Implementations§
impl Freeze for ActionEventPublisher
impl RefUnwindSafe for ActionEventPublisher
impl Send for ActionEventPublisher
impl Sync for ActionEventPublisher
impl Unpin for ActionEventPublisher
impl UnwindSafe for ActionEventPublisher
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
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 more