use std::fmt;
use crate::Driver;
pub enum EmitError<D: Driver> {
Driver(D::Error),
Parser(socketioxide_core::parser::ParserError),
}
impl<D: Driver> fmt::Debug for EmitError<D> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
EmitError::Driver(err) => write!(f, "Driver error: {}", err),
EmitError::Parser(err) => write!(f, "Serialization error: {}", err),
}
}
}
impl<D: Driver> fmt::Display for EmitError<D> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(self, f)
}
}
impl<D: Driver> std::error::Error for EmitError<D> {}
#[derive(Debug, Clone, Copy, Default)]
pub enum Parser {
#[cfg(feature = "common-parser")]
#[cfg_attr(feature = "common-parser", default)]
Common,
#[cfg(feature = "msgpack-parser")]
#[cfg_attr(
all(feature = "msgpack-parser", not(feature = "common-parser")),
default
)]
MsgPack,
}