Skip to main content

AsyncDomainEventPublisher

Trait AsyncDomainEventPublisher 

Source
pub trait AsyncDomainEventPublisher {
    type Event: DomainEvent;
    type Error;

    // Required method
    fn publish<'a>(
        &'a mut self,
        event: &'a Self::Event,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'a>>;
}
Expand description

English:
Publishes domain events asynchronously. Implementations define the event type and error type; publish borrows both the publisher and event until its returned future completes.

日本語:
ドメインイベントを非同期に発行します。実装側がイベント型とエラー型を定義します。 publish が返す future の完了まで、パブリッシャーとイベントの借用が保持されます。

Required Associated Types§

Source

type Event: DomainEvent

English:
Event type accepted by this publisher.

日本語:
このパブリッシャーが受け付けるイベント型です。

Source

type Error

English:
Error returned when publishing fails.

日本語:
発行に失敗したときに返されるエラー型です。

Required Methods§

Source

fn publish<'a>( &'a mut self, event: &'a Self::Event, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'a>>

English:
Publishes event and resolves to Ok(()) on success or the implementation’s error on failure. The returned future is Send and borrows self and event for 'a.

日本語:
event を発行し、成功時は Ok(())、失敗時は実装が定めるエラーで解決します。 返される future は Send であり、'a の間 self と event を借用します。

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§