pub trait Driver {
type Event;
type Error;
// Required methods
fn handle_input(
&mut self,
now: Instant,
peer: SocketAddr,
bytes: &[u8],
) -> Result<(), Self::Error>;
fn handle_timeout(&mut self, now: Instant);
fn poll_transmit(&mut self, now: Instant) -> Option<Transmit<'_>>;
fn poll_event(&mut self) -> Option<Self::Event>;
fn poll_timeout(&self) -> Option<Instant>;
}Expand description
Sans-io driver. Mirrors quinn-proto::Connection and
rustls::Connection.
The shell calls these methods in a loop. The core never calls
back into the shell. Time is injected via the now: Instant
parameter on every call — implementors of this trait must NOT
consult Instant::now() themselves.
Required Associated Types§
Required Methods§
Sourcefn handle_input(
&mut self,
now: Instant,
peer: SocketAddr,
bytes: &[u8],
) -> Result<(), Self::Error>
fn handle_input( &mut self, now: Instant, peer: SocketAddr, bytes: &[u8], ) -> Result<(), Self::Error>
Feed an inbound datagram. Parses, advances state, may push events / outbound packets / timer updates.
§Errors
Returns the protocol-specific error if the bytes cannot be parsed.
Sourcefn handle_timeout(&mut self, now: Instant)
fn handle_timeout(&mut self, now: Instant)
Tell the core that wall time has advanced.
Sourcefn poll_transmit(&mut self, now: Instant) -> Option<Transmit<'_>>
fn poll_transmit(&mut self, now: Instant) -> Option<Transmit<'_>>
Pop the next outbound datagram, if any.
Sourcefn poll_event(&mut self) -> Option<Self::Event>
fn poll_event(&mut self) -> Option<Self::Event>
Pop the next consumer-visible event.
Sourcefn poll_timeout(&self) -> Option<Instant>
fn poll_timeout(&self) -> Option<Instant>
Earliest instant at which the core needs to be re-entered.
None means “no pending timer — only wake me on input”.