Skip to main content

Effect

Trait Effect 

Source
pub trait Effect:
    Sized
    + Send
    + Sync
    + Serialize
    + DeserializeOwned {
    // Provided method
    fn combine(self, _other: Self) -> Option<Self> { ... }
}
Expand description

效果 — 描述一次状态转换的领域事件。

Effect 是不可变的、可序列化的、自包含的。 状态通过 apply(effect) 变更,而非直接修改。

Provided Methods§

Source

fn combine(self, _other: Self) -> Option<Self>

将此 Effect 合并到另一个同类型 Effect 中(可选)。

用于批量场景:多个 Effect 合并为一个,减少 apply 次数。 默认返回 None 表示不可合并。

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§