Trait Topic
potatonet_common
pub trait Topic: Serialize + DeserializeOwned + Send + Sync + 'static { fn name() -> &'static str; fn encode(&self) -> Result<Vec<u8>> { ... } fn decode(data: &[u8]) -> Result<Self> { ... } }
订阅消息
fn name() -> &'static str
fn encode(&self) -> Result<Vec<u8>>
fn decode(data: &[u8]) -> Result<Self>