pub struct SocketCanBus { /* private fields */ }Expand description
Linux SocketCAN bus.
Implementations§
Source§impl SocketCanBus
impl SocketCanBus
Sourcepub fn open(interface: &str, fd_enabled: bool) -> Result<Self, TransportError>
pub fn open(interface: &str, fd_enabled: bool) -> Result<Self, TransportError>
Open a SocketCAN interface.
With fd_enabled = true the socket is configured for CAN-FD
(CAN_RAW_FD_FRAMES) and the bus advertises BusCapabilities::fd(); the
interface itself must be FD-capable. With fd_enabled = false the bus is
classical-only (no FD socket option, 8-byte payload cap).
Trait Implementations§
Source§impl CanBus for SocketCanBus
impl CanBus for SocketCanBus
Source§fn capabilities(&self) -> BusCapabilities
fn capabilities(&self) -> BusCapabilities
Runtime capabilities of this bus (FD support, max payload length).
Source§fn send(&mut self, frame: &CanFrame) -> Result<(), TransportError>
fn send(&mut self, frame: &CanFrame) -> Result<(), TransportError>
Send a single frame. Must not call
read or poll internally.Source§fn drain_inbound_nonblocking(&mut self) -> Result<Vec<CanFrame>, TransportError>
fn drain_inbound_nonblocking(&mut self) -> Result<Vec<CanFrame>, TransportError>
Drain every frame currently in the receive queue and return them in
arrival order. Returns
Ok(vec![]) immediately if the queue is empty.Auto Trait Implementations§
impl Freeze for SocketCanBus
impl RefUnwindSafe for SocketCanBus
impl Send for SocketCanBus
impl Sync for SocketCanBus
impl Unpin for SocketCanBus
impl UnsafeUnpin for SocketCanBus
impl UnwindSafe for SocketCanBus
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more