embedded_can_socketcan/
non_linux.rs1use core::fmt;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5pub struct UnsupportedPlatformError;
6
7impl fmt::Display for UnsupportedPlatformError {
8 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
9 write!(
10 f,
11 "embedded-can-socketcan is only supported on Linux targets"
12 )
13 }
14}
15
16impl std::error::Error for UnsupportedPlatformError {}
17
18#[derive(Debug, Default)]
20pub struct SocketCan;
21
22impl SocketCan {
23 pub fn open(_iface: &str) -> Result<Self, UnsupportedPlatformError> {
25 Err(UnsupportedPlatformError)
26 }
27}
28
29#[derive(Debug, Default)]
31pub struct SocketCanFd;
32
33impl SocketCanFd {
34 pub fn open(_iface: &str) -> Result<Self, UnsupportedPlatformError> {
36 Err(UnsupportedPlatformError)
37 }
38}
39
40#[cfg(feature = "tokio")]
42#[derive(Debug, Default)]
43pub struct TokioSocketCan;
44
45#[cfg(feature = "tokio")]
47#[derive(Debug, Default)]
48pub struct TokioSocketCanFd;