pub trait Flow: DataFraction {
type Action: DataFraction;
type Event: DataFraction;
// Required methods
fn stream_type() -> StreamType;
fn apply(&mut self, event: Self::Event);
// Provided methods
fn pack_state(&self) -> Result<PackedState, Error> { ... }
fn unpack_state(data: &PackedState) -> Result<Self, Error> { ... }
fn pack_event(delta: &Self::Event) -> Result<PackedEvent, Error> { ... }
fn unpack_event(data: &PackedEvent) -> Result<Self::Event, Error> { ... }
fn pack_action(action: &Self::Action) -> Result<PackedAction, Error> { ... }
fn unpack_action(data: &PackedAction) -> Result<Self::Action, Error> { ... }
}
Expand description
Immutable state of a data flow.
Required Associated Types§
Sourcetype Action: DataFraction
type Action: DataFraction
ControlEvent
- that send from a client to a server
Sourcetype Event: DataFraction
type Event: DataFraction
UpdateEvent
- that sent from a server to a client
Required Methods§
fn stream_type() -> StreamType
fn apply(&mut self, event: Self::Event)
Provided Methods§
fn pack_state(&self) -> Result<PackedState, Error>
fn unpack_state(data: &PackedState) -> Result<Self, Error>
fn pack_event(delta: &Self::Event) -> Result<PackedEvent, Error>
fn unpack_event(data: &PackedEvent) -> Result<Self::Event, Error>
fn pack_action(action: &Self::Action) -> Result<PackedAction, Error>
fn unpack_action(data: &PackedAction) -> Result<Self::Action, Error>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.