pub struct CanFdSocket(/* private fields */);Expand description
A socket for CAN FD devices.
This can transmit and receive CAN 2.0 frames with up to 8-bytes of data, or CAN Flexible Data (FD) frames with up to 64-bytes of data.
Implementations§
Source§impl CanFdSocket
impl CanFdSocket
Sourcepub fn read_raw_frame(&self) -> IoResult<CanRawFrame>
pub fn read_raw_frame(&self) -> IoResult<CanRawFrame>
Reads a raw CAN frame from the socket.
This might be either type of CAN frame, a classic CAN 2.0 frame or an FD frame.
Trait Implementations§
Source§impl AsFd for CanFdSocket
impl AsFd for CanFdSocket
Source§fn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
Source§impl AsRawFd for CanFdSocket
impl AsRawFd for CanFdSocket
Source§impl Can for CanFdSocket
impl Can for CanFdSocket
Source§fn receive(&mut self) -> Result<Self::Frame>
fn receive(&mut self) -> Result<Self::Frame>
Blocking call to receive the next frame from the bus.
This block and wait for the next frame to be received from the bus.
If an error frame is received, it will be converted to a CanError
and returned as an error.
Source§fn transmit(&mut self, frame: &Self::Frame) -> Result<()>
fn transmit(&mut self, frame: &Self::Frame) -> Result<()>
Blocking transmit of a frame to the bus.
Source§type Frame = CanAnyFrame
type Frame = CanAnyFrame
Source§impl Can for CanFdSocket
impl Can for CanFdSocket
Source§fn receive(&mut self) -> Result<Self::Frame, Self::Error>
fn receive(&mut self) -> Result<Self::Frame, Self::Error>
Non-blocking call to receive the next frame from the bus.
If an error frame is received, it will be converted to a CanError
and returned as an error.
If no frame is available, it returns a WouldBlck error.
Source§fn transmit(
&mut self,
frame: &Self::Frame,
) -> Result<Option<Self::Frame>, Self::Error>
fn transmit( &mut self, frame: &Self::Frame, ) -> Result<Option<Self::Frame>, Self::Error>
Non-blocking transmit of a frame to the bus.
Source§type Frame = CanAnyFrame
type Frame = CanAnyFrame
Source§impl Debug for CanFdSocket
impl Debug for CanFdSocket
Source§impl From<OwnedFd> for CanFdSocket
impl From<OwnedFd> for CanFdSocket
Source§impl IntoRawFd for CanFdSocket
impl IntoRawFd for CanFdSocket
Source§fn into_raw_fd(self) -> RawFd
fn into_raw_fd(self) -> RawFd
Source§impl Read for CanFdSocket
impl Read for CanFdSocket
Source§fn read(&mut self, buf: &mut [u8]) -> IoResult<usize>
fn read(&mut self, buf: &mut [u8]) -> IoResult<usize>
1.36.0 · Source§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
read, except that it reads into a slice of buffers. Read moreSource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector)1.0.0 · Source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
buf. Read more1.0.0 · Source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
buf. Read more1.6.0 · Source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
buf. Read moreSource§fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
read_buf)Source§fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
read_buf)cursor. Read more1.0.0 · Source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Read. Read moreSource§impl Socket for CanFdSocket
impl Socket for CanFdSocket
Source§type FrameType = CanAnyFrame
type FrameType = CanAnyFrame
CanFdSocket can read/write classic CAN 2.0 or FD frames.
Source§fn as_raw_socket(&self) -> &Socket ⓘ
fn as_raw_socket(&self) -> &Socket ⓘ
Gets a shared reference to the underlying socket object
Source§fn as_raw_socket_mut(&mut self) -> &mut Socket ⓘ
fn as_raw_socket_mut(&mut self) -> &mut Socket ⓘ
Gets a mutable reference to the underlying socket object
Source§fn write_frame<F>(&self, frame: &F) -> IoResult<()>
fn write_frame<F>(&self, frame: &F) -> IoResult<()>
Writes any type of CAN frame to the socket.
Source§fn read_frame(&self) -> IoResult<CanAnyFrame>
fn read_frame(&self) -> IoResult<CanAnyFrame>
Reads either type of CAN frame from the socket.
Source§fn open_iface(ifindex: u32) -> IoResult<Self>where
Self: Sized,
fn open_iface(ifindex: u32) -> IoResult<Self>where
Self: Sized,
Source§fn nonblocking(&self) -> IoResult<bool>
fn nonblocking(&self) -> IoResult<bool>
Source§fn set_nonblocking(&self, nonblocking: bool) -> IoResult<()>
fn set_nonblocking(&self, nonblocking: bool) -> IoResult<()>
Source§fn read_timeout(&self) -> IoResult<Option<Duration>>
fn read_timeout(&self) -> IoResult<Option<Duration>>
Source§fn set_read_timeout<D>(&self, duration: D) -> IoResult<()>
fn set_read_timeout<D>(&self, duration: D) -> IoResult<()>
Source§fn write_timeout(&self) -> IoResult<Option<Duration>>
fn write_timeout(&self) -> IoResult<Option<Duration>>
Source§fn set_write_timeout<D>(&self, duration: D) -> IoResult<()>
fn set_write_timeout<D>(&self, duration: D) -> IoResult<()>
Source§impl SocketOptions for CanFdSocket
impl SocketOptions for CanFdSocket
Source§fn set_socket_option<T>(
&self,
level: c_int,
name: c_int,
val: &T,
) -> IoResult<()>
fn set_socket_option<T>( &self, level: c_int, name: c_int, val: &T, ) -> IoResult<()>
Source§fn set_socket_option_mult<T>(
&self,
level: c_int,
name: c_int,
values: &[T],
) -> IoResult<()>
fn set_socket_option_mult<T>( &self, level: c_int, name: c_int, values: &[T], ) -> IoResult<()>
Source§fn set_filters<F>(&self, filters: &[F]) -> IoResult<()>
fn set_filters<F>(&self, filters: &[F]) -> IoResult<()>
Source§fn set_filter_accept_all(&self) -> IoResult<()>
fn set_filter_accept_all(&self) -> IoResult<()>
Source§fn set_error_filter(&self, mask: u32) -> IoResult<()>
fn set_error_filter(&self, mask: u32) -> IoResult<()>
Source§fn set_error_filter_drop_all(&self) -> IoResult<()>
fn set_error_filter_drop_all(&self) -> IoResult<()>
Source§fn set_error_filter_accept_all(&self) -> IoResult<()>
fn set_error_filter_accept_all(&self) -> IoResult<()>
Source§fn set_error_mask(&self, mask: u32) -> IoResult<()>
fn set_error_mask(&self, mask: u32) -> IoResult<()>
Source§impl TryFrom<CanSocket> for CanFdSocket
impl TryFrom<CanSocket> for CanFdSocket
Source§impl Write for CanFdSocket
impl Write for CanFdSocket
Source§fn write(&mut self, buf: &[u8]) -> IoResult<usize>
fn write(&mut self, buf: &[u8]) -> IoResult<usize>
Source§fn flush(&mut self) -> IoResult<()>
fn flush(&mut self) -> IoResult<()>
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored)Auto Trait Implementations§
impl Freeze for CanFdSocket
impl RefUnwindSafe for CanFdSocket
impl Send for CanFdSocket
impl Sync for CanFdSocket
impl Unpin for CanFdSocket
impl UnwindSafe for CanFdSocket
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
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>
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>
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 moreSource§impl<R> ReadBytesExt for R
impl<R> ReadBytesExt for R
Source§fn read_u8(&mut self) -> Result<u8, Error>
fn read_u8(&mut self) -> Result<u8, Error>
Source§fn read_i8(&mut self) -> Result<i8, Error>
fn read_i8(&mut self) -> Result<i8, Error>
Source§fn read_u16<T>(&mut self) -> Result<u16, Error>where
T: ByteOrder,
fn read_u16<T>(&mut self) -> Result<u16, Error>where
T: ByteOrder,
Source§fn read_i16<T>(&mut self) -> Result<i16, Error>where
T: ByteOrder,
fn read_i16<T>(&mut self) -> Result<i16, Error>where
T: ByteOrder,
Source§fn read_u24<T>(&mut self) -> Result<u32, Error>where
T: ByteOrder,
fn read_u24<T>(&mut self) -> Result<u32, Error>where
T: ByteOrder,
Source§fn read_i24<T>(&mut self) -> Result<i32, Error>where
T: ByteOrder,
fn read_i24<T>(&mut self) -> Result<i32, Error>where
T: ByteOrder,
Source§fn read_u32<T>(&mut self) -> Result<u32, Error>where
T: ByteOrder,
fn read_u32<T>(&mut self) -> Result<u32, Error>where
T: ByteOrder,
Source§fn read_i32<T>(&mut self) -> Result<i32, Error>where
T: ByteOrder,
fn read_i32<T>(&mut self) -> Result<i32, Error>where
T: ByteOrder,
Source§fn read_u48<T>(&mut self) -> Result<u64, Error>where
T: ByteOrder,
fn read_u48<T>(&mut self) -> Result<u64, Error>where
T: ByteOrder,
Source§fn read_i48<T>(&mut self) -> Result<i64, Error>where
T: ByteOrder,
fn read_i48<T>(&mut self) -> Result<i64, Error>where
T: ByteOrder,
Source§fn read_u64<T>(&mut self) -> Result<u64, Error>where
T: ByteOrder,
fn read_u64<T>(&mut self) -> Result<u64, Error>where
T: ByteOrder,
Source§fn read_i64<T>(&mut self) -> Result<i64, Error>where
T: ByteOrder,
fn read_i64<T>(&mut self) -> Result<i64, Error>where
T: ByteOrder,
Source§fn read_u128<T>(&mut self) -> Result<u128, Error>where
T: ByteOrder,
fn read_u128<T>(&mut self) -> Result<u128, Error>where
T: ByteOrder,
Source§fn read_i128<T>(&mut self) -> Result<i128, Error>where
T: ByteOrder,
fn read_i128<T>(&mut self) -> Result<i128, Error>where
T: ByteOrder,
Source§fn read_uint<T>(&mut self, nbytes: usize) -> Result<u64, Error>where
T: ByteOrder,
fn read_uint<T>(&mut self, nbytes: usize) -> Result<u64, Error>where
T: ByteOrder,
Source§fn read_int<T>(&mut self, nbytes: usize) -> Result<i64, Error>where
T: ByteOrder,
fn read_int<T>(&mut self, nbytes: usize) -> Result<i64, Error>where
T: ByteOrder,
Source§fn read_uint128<T>(&mut self, nbytes: usize) -> Result<u128, Error>where
T: ByteOrder,
fn read_uint128<T>(&mut self, nbytes: usize) -> Result<u128, Error>where
T: ByteOrder,
Source§fn read_int128<T>(&mut self, nbytes: usize) -> Result<i128, Error>where
T: ByteOrder,
fn read_int128<T>(&mut self, nbytes: usize) -> Result<i128, Error>where
T: ByteOrder,
Source§fn read_f32<T>(&mut self) -> Result<f32, Error>where
T: ByteOrder,
fn read_f32<T>(&mut self) -> Result<f32, Error>where
T: ByteOrder,
Source§fn read_f64<T>(&mut self) -> Result<f64, Error>where
T: ByteOrder,
fn read_f64<T>(&mut self) -> Result<f64, Error>where
T: ByteOrder,
Source§fn read_u16_into<T>(&mut self, dst: &mut [u16]) -> Result<(), Error>where
T: ByteOrder,
fn read_u16_into<T>(&mut self, dst: &mut [u16]) -> Result<(), Error>where
T: ByteOrder,
Source§fn read_u32_into<T>(&mut self, dst: &mut [u32]) -> Result<(), Error>where
T: ByteOrder,
fn read_u32_into<T>(&mut self, dst: &mut [u32]) -> Result<(), Error>where
T: ByteOrder,
Source§fn read_u64_into<T>(&mut self, dst: &mut [u64]) -> Result<(), Error>where
T: ByteOrder,
fn read_u64_into<T>(&mut self, dst: &mut [u64]) -> Result<(), Error>where
T: ByteOrder,
Source§fn read_u128_into<T>(&mut self, dst: &mut [u128]) -> Result<(), Error>where
T: ByteOrder,
fn read_u128_into<T>(&mut self, dst: &mut [u128]) -> Result<(), Error>where
T: ByteOrder,
Source§fn read_i8_into(&mut self, dst: &mut [i8]) -> Result<(), Error>
fn read_i8_into(&mut self, dst: &mut [i8]) -> Result<(), Error>
Source§fn read_i16_into<T>(&mut self, dst: &mut [i16]) -> Result<(), Error>where
T: ByteOrder,
fn read_i16_into<T>(&mut self, dst: &mut [i16]) -> Result<(), Error>where
T: ByteOrder,
Source§fn read_i32_into<T>(&mut self, dst: &mut [i32]) -> Result<(), Error>where
T: ByteOrder,
fn read_i32_into<T>(&mut self, dst: &mut [i32]) -> Result<(), Error>where
T: ByteOrder,
Source§fn read_i64_into<T>(&mut self, dst: &mut [i64]) -> Result<(), Error>where
T: ByteOrder,
fn read_i64_into<T>(&mut self, dst: &mut [i64]) -> Result<(), Error>where
T: ByteOrder,
Source§fn read_i128_into<T>(&mut self, dst: &mut [i128]) -> Result<(), Error>where
T: ByteOrder,
fn read_i128_into<T>(&mut self, dst: &mut [i128]) -> Result<(), Error>where
T: ByteOrder,
Source§fn read_f32_into<T>(&mut self, dst: &mut [f32]) -> Result<(), Error>where
T: ByteOrder,
fn read_f32_into<T>(&mut self, dst: &mut [f32]) -> Result<(), Error>where
T: ByteOrder,
Source§fn read_f32_into_unchecked<T>(&mut self, dst: &mut [f32]) -> Result<(), Error>where
T: ByteOrder,
fn read_f32_into_unchecked<T>(&mut self, dst: &mut [f32]) -> Result<(), Error>where
T: ByteOrder,
read_f32_into instead