pub type CanFdSocket = AsyncCanSocket<CanFdSocket>;tokio only.Expand description
An Asynchronous CAN FD Socket
Aliased Type§
pub struct CanFdSocket(/* private fields */);Implementations§
Source§impl CanFdSocket
impl CanFdSocket
Sourcepub async fn write_frame<F>(&self, frame: &F) -> IoResult<()>
pub async fn write_frame<F>(&self, frame: &F) -> IoResult<()>
Write a CAN FD frame to the socket asynchronously
Sourcepub fn try_write_frame<F>(&self, frame: &F) -> IoResult<()>
pub fn try_write_frame<F>(&self, frame: &F) -> IoResult<()>
Attempt to write a CAN frame to the socket without blocking.
Returns WouldBlock if the send buffer is full.
Bypasses the tokio readiness reactor: this call goes straight to
the underlying non-blocking fd, so no AsyncFd readiness event is
consumed. Mixing with write_frame on the same
socket is safe — the async path will simply re-check OS-level
readiness on its next poll and may briefly round-trip through
WouldBlock before re-arming.
Sourcepub async fn read_frame(&self) -> IoResult<CanAnyFrame>
pub async fn read_frame(&self) -> IoResult<CanAnyFrame>
Reads a CAN FD frame from the socket asynchronously
Sourcepub fn try_read_frame(&self) -> IoResult<CanAnyFrame>
pub fn try_read_frame(&self) -> IoResult<CanAnyFrame>
Attempt to read a CAN frame from the socket without blocking.
Returns WouldBlock if no frame is immediately available.
Bypasses the tokio readiness reactor: this call goes straight to
the underlying non-blocking fd, so no AsyncFd readiness event is
consumed. Mixing with read_frame on the same
socket is safe — the async path will simply re-check OS-level
readiness on its next poll and may briefly round-trip through
WouldBlock before re-arming.
Sourcepub fn has_hw_timestamps(&self) -> bool
pub fn has_hw_timestamps(&self) -> bool
Returns true if the bound interface supports hardware receive timestamps.
Sourcepub async fn read_frame_with_timestamp(
&self,
) -> IoResult<(CanAnyFrame, SystemTime)>
pub async fn read_frame_with_timestamp( &self, ) -> IoResult<(CanAnyFrame, SystemTime)>
Read a CAN frame and its socket-layer arrival timestamp asynchronously.
Requires SocketOptions::set_recv_timestamp to be called first.
Sourcepub async fn read_frame_with_timestamps(
&self,
) -> IoResult<(CanAnyFrame, CanTimestamps)>
pub async fn read_frame_with_timestamps( &self, ) -> IoResult<(CanAnyFrame, CanTimestamps)>
Read a CAN frame and all available timestamps asynchronously.
Timestamp fields are None for modes not enabled on the socket.
Sourcepub async fn read_frame_with_hw_timestamp(
&self,
) -> IoResult<(CanAnyFrame, Duration)>
pub async fn read_frame_with_hw_timestamp( &self, ) -> IoResult<(CanAnyFrame, Duration)>
Read a CAN frame and its raw hardware clock timestamp asynchronously.
Requires SocketOptions::set_timestamping with
SOF_TIMESTAMPING_RX_HARDWARE | SOF_TIMESTAMPING_OPT_CMSG to be called first.
Trait Implementations§
Source§impl AsyncRead for CanFdSocket
impl AsyncRead for CanFdSocket
Source§impl AsyncWrite for CanFdSocket
impl AsyncWrite for CanFdSocket
Source§fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<IoResult<usize>>
fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<IoResult<usize>>
buf into the object. Read moreSource§fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<IoResult<()>>
fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<IoResult<()>>
Source§fn poll_shutdown(
self: Pin<&mut Self>,
_cx: &mut Context<'_>,
) -> Poll<IoResult<()>>
fn poll_shutdown( self: Pin<&mut Self>, _cx: &mut Context<'_>, ) -> Poll<IoResult<()>>
Source§fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
bufs: &[IoSlice<'_>],
) -> Poll<Result<usize, Error>>
fn poll_write_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>], ) -> Poll<Result<usize, Error>>
poll_write, except that it writes from a slice of buffers. Read moreSource§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
poll_write_vectored
implementation. Read moreSource§impl Sink<CanAnyFrame> for CanFdSocket
impl Sink<CanAnyFrame> for CanFdSocket
Source§fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Sink to receive a value. Read moreSource§fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<()>>
Source§fn poll_close(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_close(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<()>>
Source§fn start_send(self: Pin<&mut Self>, item: CanAnyFrame) -> Result<()>
fn start_send(self: Pin<&mut Self>, item: CanAnyFrame) -> Result<()>
poll_ready which returned Poll::Ready(Ok(())). Read more