zoe_wire_protocol/
services.rs1use serde::{Deserialize, Serialize};
2use std::fmt;
3
4#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
5pub enum ZoeServices {
6 Messages = 10,
7 Blob = 11,
8}
9
10impl fmt::Display for ZoeServices {
11 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
12 match self {
13 ZoeServices::Messages => write!(f, "Messages"),
14 ZoeServices::Blob => write!(f, "Blob"),
15 }
16 }
17}
18
19impl TryFrom<u8> for ZoeServices {
20 type Error = ();
21
22 fn try_from(value: u8) -> Result<Self, Self::Error> {
23 match value {
24 10 => Ok(ZoeServices::Messages),
25 11 => Ok(ZoeServices::Blob),
26 _ => Err(()),
27 }
28 }
29}