Closed Thomasdezeeuw closed 5 years ago
I don't really see a solution for this. The easiest way to remove the need for the generic parameter is to wrap the call to poll in your own method that returns an error. For example:
struct MyEvents {
events: Vec<Event>,
os_queue: OsQueue,
timers: Timers,
}
impl MyEvents {
pub fn poll(&mut self) -> Result<(), io::Error> {
// No need to specify the error type.
poll(&mut [&mut self.os_queue, &mut self.timer], &mut self.events, None)
}
}
Currently
poll
has two generic parameters of which the error is almost never inferred, e.g. from the example of the crate docs.