pub struct Transfer { /* private fields */ }Expand description
Sans-IO XModem transfer, sender or receiver. See the crate documentation for the driver loop.
Implementations§
Source§impl Transfer
impl Transfer
Sourcepub fn start(
&mut self,
now: Instant,
command: Command,
) -> Result<(), StartError>
pub fn start( &mut self, now: Instant, command: Command, ) -> Result<(), StartError>
Begin a transfer. A sender waits for the receiver’s start character
(nothing to write yet); a receiver’s first start character is available
from poll_output(now) at once.
Output and events of the previous transfer that were not polled yet
are dropped; a linger after it (Config::linger) ends.
Sourcepub fn handle_input(&mut self, now: Instant, bytes: &[u8])
pub fn handle_input(&mut self, now: Instant, bytes: &[u8])
Feed bytes read from the link, in any chunking.
Sourcepub fn handle_timeout(&mut self, now: Instant)
pub fn handle_timeout(&mut self, now: Instant)
Call when the time from Transfer::next_timeout has passed (or
whenever a read times out; it does nothing early).
Sourcepub fn poll_output(&mut self, now: Instant) -> Option<Vec<u8>>
pub fn poll_output(&mut self, now: Instant) -> Option<Vec<u8>>
Next bytes to write, written atomically: a whole block, a single
control byte, or the CAN sequence. Keep calling after Done/Error
until None: a final ACK or the CANs may still be queued.
Sourcepub fn poll_event(&mut self) -> Option<Event>
pub fn poll_event(&mut self) -> Option<Event>
Next event, in order.
Sourcepub fn next_timeout(&self) -> Option<Instant>
pub fn next_timeout(&self) -> Option<Instant>
The earliest instant at which Transfer::handle_timeout has work.
Sourcepub fn is_idle(&self) -> bool
pub fn is_idle(&self) -> bool
No transfer running and no linger after one (output may still be queued).
Sourcepub fn check(&self) -> Check
pub fn check(&self) -> Check
The check in use (receive: requested so far; settled after
Event::Started).