Skip to main content

DomainEventConversion

Trait DomainEventConversion 

Source
pub trait DomainEventConversion: DomainEvent {
    type Output;
    type Error;

    // Required method
    fn convert(&self) -> Result<Self::Output, Self::Error>;
}
Expand description

English:
Converts a domain event into an associated output type.

The conversion borrows the event, so implementations can inspect it without taking ownership. A failed conversion returns the associated Self::Error value and does not produce output. The trait does not prescribe serialization, allocation, or whether the conversion is deterministic.

日本語:
ドメインイベントを関連付けられた出力型へ変換します。

変換はイベントを借用して行うため、所有権を取り上げずにイベントを検査できます。 変換に失敗した場合は関連付けられた Self::Error の値を返し、出力は生成しません。 シリアライズ、メモリアロケーション、変換結果の決定性はこのトレイトでは規定しません。

Required Associated Types§

Source

type Output

English:
The value produced when conversion succeeds.

日本語:
変換に成功したときに生成される値です。

Source

type Error

English:
The error returned when conversion fails.

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

Required Methods§

Source

fn convert(&self) -> Result<Self::Output, Self::Error>

English:
Converts this event without consuming it.

Returns Self::Output on success or Self::Error when the event cannot be converted. Panics only if the implementation itself panics.

日本語:
このイベントを消費せずに変換します。

成功時は Self::Output を返し、イベントを変換できない場合は Self::Error を返します。 パニックするのは実装自体がパニックする場合だけです。

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§