socketioxide_emitter/
emit.rs1use std::fmt;
2
3use crate::Driver;
4
5pub enum EmitError<D: Driver> {
7 Driver(D::Error),
9 Parser(socketioxide_core::parser::ParserError),
11}
12impl<D: Driver> fmt::Debug for EmitError<D> {
13 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
14 match self {
15 EmitError::Driver(err) => write!(f, "Driver error: {}", err),
16 EmitError::Parser(err) => write!(f, "Serialization error: {}", err),
17 }
18 }
19}
20impl<D: Driver> fmt::Display for EmitError<D> {
21 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
22 fmt::Debug::fmt(self, f)
23 }
24}
25impl<D: Driver> std::error::Error for EmitError<D> {}
26
27#[derive(Debug, Clone, Copy, Default)]
30pub enum Parser {
31 #[cfg(feature = "common-parser")]
34 #[cfg_attr(feature = "common-parser", default)]
35 Common,
36 #[cfg(feature = "msgpack-parser")]
39 #[cfg_attr(
40 all(feature = "msgpack-parser", not(feature = "common-parser")),
41 default
42 )]
43 MsgPack,
44}