pub struct SocketCanDriver;Expand description
SocketCAN driver — factory for opening CAN channels.
Implements the Driver trait using kernel interface indices.
Also provides channel_by_name for
opening by interface name (e.g., "can0", "vcan0").
§Example
use can_hal::{Driver, ChannelBuilder};
use can_hal_socketcan::SocketCanDriver;
let driver = SocketCanDriver::new();
let mut channel = driver
.channel_by_name("vcan0")
.unwrap()
.bitrate(500_000)
.unwrap()
.connect()
.unwrap();Implementations§
Source§impl SocketCanDriver
impl SocketCanDriver
pub const fn new() -> Self
Sourcepub fn channel_by_name(
&self,
name: &str,
) -> Result<SocketCanChannelBuilder, SocketCanError>
pub fn channel_by_name( &self, name: &str, ) -> Result<SocketCanChannelBuilder, SocketCanError>
Begin configuring a channel on the named interface.
Trait Implementations§
Source§impl Default for SocketCanDriver
impl Default for SocketCanDriver
Source§impl Driver for SocketCanDriver
impl Driver for SocketCanDriver
impl DriverFd for SocketCanDriver
Auto Trait Implementations§
impl Freeze for SocketCanDriver
impl RefUnwindSafe for SocketCanDriver
impl Send for SocketCanDriver
impl Sync for SocketCanDriver
impl Unpin for SocketCanDriver
impl UnsafeUnpin for SocketCanDriver
impl UnwindSafe for SocketCanDriver
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more