danube_core/
dispatch_strategy.rs1use crate::proto::DispatchStrategy as ProtoDispatchStrategy;
2use serde::{Deserialize, Serialize};
3use std::fmt::{Display, Formatter};
4
5#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
7pub enum ConfigDispatchStrategy {
8 NonReliable,
10 Reliable,
12}
13
14impl Default for ConfigDispatchStrategy {
15 fn default() -> Self {
16 ConfigDispatchStrategy::NonReliable
17 }
18}
19
20impl Display for ConfigDispatchStrategy {
21 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
22 match self {
23 ConfigDispatchStrategy::NonReliable => write!(f, "Non-Reliable"),
24 ConfigDispatchStrategy::Reliable => write!(f, "Reliable"),
25 }
26 }
27}
28
29impl From<ProtoDispatchStrategy> for ConfigDispatchStrategy {
30 fn from(s: ProtoDispatchStrategy) -> Self {
31 match s {
32 ProtoDispatchStrategy::NonReliable => ConfigDispatchStrategy::NonReliable,
33 ProtoDispatchStrategy::Reliable => ConfigDispatchStrategy::Reliable,
34 }
35 }
36}