Reduce memory overhead and simplify logic for merging endpoint and control request output reports.

This commit is contained in:
alexmoon
2022-04-01 15:48:37 -04:00
committed by Dario Nieuwenhuis
parent c309531874
commit c8ad82057d
4 changed files with 163 additions and 61 deletions

View File

@ -120,6 +120,9 @@ pub trait Endpoint {
pub trait EndpointOut: Endpoint {
type ReadFuture<'a>: Future<Output = Result<usize, ReadError>> + 'a
where
Self: 'a;
type DataReadyFuture<'a>: Future<Output = ()> + 'a
where
Self: 'a;
@ -128,6 +131,11 @@ pub trait EndpointOut: Endpoint {
///
/// This should also clear any NAK flags and prepare the endpoint to receive the next packet.
fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Self::ReadFuture<'a>;
/// Waits until a packet of data is ready to be read from the endpoint.
///
/// A call to[`read()`](Self::read()) after this future completes should not block.
fn wait_data_ready<'a>(&'a mut self) -> Self::DataReadyFuture<'a>;
}
pub trait ControlPipe {