pub struct CanInterface { /* private fields */ }
Expand description
SocketCAN interface
Controlled through the kernel’s Netlink interface, CAN devices can be brought up or down or configured through this.
Implementations§
Source§impl CanInterface
impl CanInterface
Sourcepub fn open(ifname: &str) -> Result<Self, Error>
pub fn open(ifname: &str) -> Result<Self, Error>
Open CAN interface by name
Similar to open_if
, but looks up the device by name instead
Sourcepub fn open_iface(if_index: u32) -> Self
pub fn open_iface(if_index: u32) -> Self
Open CAN interface
Creates a new CanInterface
instance. No actual “opening” is necessary
or performed when calling this function.
Sourcepub fn bring_down(&self) -> Result<(), NlError>
pub fn bring_down(&self) -> Result<(), NlError>
Bring down CAN interface
Use a netlink control socket to set the interface status to “down”.
Auto Trait Implementations§
impl Freeze for CanInterface
impl RefUnwindSafe for CanInterface
impl Send for CanInterface
impl Sync for CanInterface
impl Unpin for CanInterface
impl UnwindSafe for CanInterface
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