thfmr-protocol 0.2.2

Internal control protocol encoding and decoding library for the TouHou.FM Radio project
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::message;
use core::result;
use thiserror::Error;
use tokio::{io, sync::mpsc};

#[derive(Error, Debug)]
pub enum ProtocolError {
    #[error("io error")]
    Io(#[from] io::Error),
    #[error("message send error")]
    SendError(#[from] mpsc::error::SendError<message::Message>),
    #[error("serialization/deserialization error")]
    SerdeJson(#[from] serde_json::Error),
    #[error("connection send error")]
    ConnectionSendError(#[from] mpsc::error::SendError<mpsc::Sender<message::Message>>),
}

pub type Result<T> = result::Result<T, ProtocolError>;