use serde::{Deserialize, Serialize};
use snafu::Snafu;
use crate::quic::ConnectionError;
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, Snafu)]
#[snafu(module(ipc_plumbing_error), visibility(pub))]
pub enum IpcPlumbingError {
#[snafu(transparent)]
Rpc { source: remoc::rtc::CallError },
#[snafu(display("{message}"))]
Io { message: String },
}
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, Snafu)]
#[snafu(module(ipc_open_error), visibility(pub))]
pub enum IpcOpenError {
#[snafu(transparent)]
Connection { source: ConnectionError },
#[snafu(transparent)]
Plumbing { source: IpcPlumbingError },
}
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, Snafu)]
#[snafu(module(ipc_accept_error), visibility(pub))]
pub enum IpcAcceptError {
#[snafu(transparent)]
Connection { source: ConnectionError },
#[snafu(transparent)]
Plumbing { source: IpcPlumbingError },
}
impl From<remoc::rtc::CallError> for IpcOpenError {
fn from(error: remoc::rtc::CallError) -> Self {
IpcPlumbingError::Rpc { source: error }.into()
}
}
impl From<remoc::rtc::CallError> for IpcAcceptError {
fn from(error: remoc::rtc::CallError) -> Self {
IpcPlumbingError::Rpc { source: error }.into()
}
}