use core::fmt;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct UnsupportedPlatformError;
impl fmt::Display for UnsupportedPlatformError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"embedded-can-socketcan is only supported on Linux targets"
)
}
}
impl std::error::Error for UnsupportedPlatformError {}
#[derive(Debug, Default)]
pub struct SocketCan;
impl SocketCan {
pub fn open(_iface: &str) -> Result<Self, UnsupportedPlatformError> {
Err(UnsupportedPlatformError)
}
}
#[derive(Debug, Default)]
pub struct SocketCanFd;
impl SocketCanFd {
pub fn open(_iface: &str) -> Result<Self, UnsupportedPlatformError> {
Err(UnsupportedPlatformError)
}
}
#[cfg(feature = "tokio")]
#[derive(Debug, Default)]
pub struct TokioSocketCan;
#[cfg(feature = "tokio")]
#[derive(Debug, Default)]
pub struct TokioSocketCanFd;