January 2019
Beginner to intermediate
554 pages
13h 31m
English
Juggling with mio's socket polling state machine is not very convenient. To provide a higher-level API that can be used by application developers, we have the futures crate. The futures crate provides a trait named Future, which is the core component of the crate. A future represents the idea of a computation that is not immediately available, but might be available later. Let's look at its type signature of the Future trait to get more information about it:
pub trait Future { type Item; type Error; fn poll(&mut self) -> Poll<Self::Item, Self::Error>;}
A Future is an associated type trait that defines two types: an Item type representing the value that the Future will resolve to and an Error type that specifies what error type the ...
Read now
Unlock full access