pub struct SocketCanDriver;Expand description
SocketCAN driver - factory for opening CAN channels.
SocketCAN bitrate, sample point, and FD timing are configured at the OS
level via ip link set or netlink - not through the socket API - so this
builder intentionally has no timing methods. Configure the interface
before calling connect:
sudo ip link set can0 type can bitrate 500000
sudo ip link set can0 up§Example
use can_hal_socketcan::SocketCanDriver;
let driver = SocketCanDriver::new();
let mut channel = driver
.channel_by_name("vcan0")
.connect()
.unwrap();Implementations§
Source§impl SocketCanDriver
impl SocketCanDriver
pub const fn new() -> Self
Sourcepub fn channel_by_name(&self, name: &str) -> SocketCanChannelBuilder
pub fn channel_by_name(&self, name: &str) -> SocketCanChannelBuilder
Begin configuring a channel on the named interface.
Sourcepub const fn channel(&self, index: u32) -> SocketCanChannelBuilder
pub const fn channel(&self, index: u32) -> SocketCanChannelBuilder
Begin configuring a channel at the given 0-based interface index.
Trait Implementations§
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