pub struct PduTx<'sto> { /* private fields */ }
Expand description
EtherCAT frame transmit adapter.
Implementations§
Source§impl<'sto> PduTx<'sto>
impl<'sto> PduTx<'sto>
Sourcepub fn next_sendable_frame(&mut self) -> Option<SendableFrame<'sto>>
pub fn next_sendable_frame(&mut self) -> Option<SendableFrame<'sto>>
Get the next sendable frame, if any are available.
Sourcepub fn replace_waker(&self, waker: &Waker)
pub fn replace_waker(&self, waker: &Waker)
Set or replace the PDU loop waker.
The waker must be set otherwise the future in charge of sending new packets will not be woken again, causing a timeout error.
§Examples
use core::future::poll_fn;
use core::task::Poll;
let (pdu_tx, _pdu_rx, _pdu_loop) = PDU_STORAGE.try_split().expect("can only split once");
poll_fn(|ctx| {
// Set the waker so this future is polled again when new EtherCAT frames are ready to
// be sent.
pdu_tx.replace_waker(ctx.waker());
// Send and receive packets over the network interface here
Poll::<()>::Pending
});
Sourcepub fn should_exit(&self) -> bool
pub fn should_exit(&self) -> bool
Returns true
if the PDU sender should exit.
This will be triggered by MainDevice::release_all
. When
giving back ownership of the PduTx
, be sure to call release
to
ensure all internal state is correct before reuse.
Auto Trait Implementations§
impl<'sto> Freeze for PduTx<'sto>
impl<'sto> !RefUnwindSafe for PduTx<'sto>
impl<'sto> Send for PduTx<'sto>
impl<'sto> Sync for PduTx<'sto>
impl<'sto> Unpin for PduTx<'sto>
impl<'sto> !UnwindSafe for PduTx<'sto>
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