Skip to main content

SocketCan

Struct SocketCan 

Source
pub struct SocketCan { /* private fields */ }
Expand description

Classic CAN SocketCAN adapter implementing embedded-can-interface traits.

Implementations§

Source§

impl SocketCan

Source

pub fn open(iface: &str) -> Result<Self, SocketcanError>

Open a SocketCAN interface by name (e.g. "can0").

Source

pub fn new(inner: CanSocket) -> Self

Wrap an existing socketcan::CanSocket.

Source

pub fn as_inner(&self) -> &CanSocket

Borrow the inner SocketCAN socket.

Source

pub fn as_inner_mut(&mut self) -> &mut CanSocket

Mutably borrow the inner SocketCAN socket.

Source

pub fn into_inner(self) -> CanSocket

Unwrap into the inner SocketCAN socket.

Trait Implementations§

Source§

impl AsRawFd for SocketCan

Source§

fn as_raw_fd(&self) -> RawFd

Extracts the raw file descriptor. Read more
Source§

impl BlockingControl for SocketCan

Source§

type Error = Error

Error returned by the driver implementation.
Source§

fn set_nonblocking(&mut self, on: bool) -> Result<(), Self::Error>

Globally toggle nonblocking mode. Read more
Source§

impl Debug for SocketCan

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FilterConfig for SocketCan

Source§

type Error = Error

Error returned by the driver implementation.
Source§

type FiltersHandle<'a> = () where Self: 'a

Handle used for modifying filters in-place (e.g. a bank accessor). Read more
Source§

fn set_filters(&mut self, filters: &[IdMaskFilter]) -> Result<(), Self::Error>

Replace the current filter configuration with a list of ID/mask pairs. Read more
Source§

fn modify_filters(&mut self) -> Self::FiltersHandle<'_>

Access filter banks through a handle (optional ergonomic API).
Source§

impl RxFrameIo for SocketCan

Source§

type Frame = CanFrame

The CAN frame type.
Source§

type Error = Error

Error returned by the driver implementation.
Source§

fn recv(&mut self) -> Result<Self::Frame, Self::Error>

Receive a frame, blocking until one is available.
Source§

fn try_recv(&mut self) -> Result<Self::Frame, Self::Error>

Attempt to receive a frame without blocking. Read more
Source§

fn recv_timeout( &mut self, timeout: Duration, ) -> Result<Self::Frame, Self::Error>

Receive a frame, waiting up to timeout. Read more
Source§

fn wait_not_empty(&mut self) -> Result<(), Self::Error>

Wait until the receive queue is non-empty. Read more
Source§

impl TxFrameIo for SocketCan

Source§

type Frame = CanFrame

The CAN frame type. Read more
Source§

type Error = Error

Error returned by the driver implementation.
Source§

fn send(&mut self, frame: &Self::Frame) -> Result<(), Self::Error>

Send a frame, blocking until it is accepted by the driver.
Source§

fn try_send(&mut self, frame: &Self::Frame) -> Result<(), Self::Error>

Attempt to send a frame without blocking. Read more
Source§

fn send_timeout( &mut self, frame: &Self::Frame, timeout: Duration, ) -> Result<(), Self::Error>

Send a frame, waiting up to timeout for the driver to accept it. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.