# tokio笔记.md

## Future

//虽然和标准库中的不要太一样,但是更好理解
trait Future {
/// The type of the value returned when the future completes.
type Item;

/// The type representing errors that occurred while processing the computation.
type Error;

/// The function that will be repeatedly called to see if the future
/// has completed or not. The Async enum can either be Ready or
/// NotReady and indicates whether the future is ready to produce
/// a value or not.
fn poll(&mut self) -> Result<Async<Self::Item>, Self::Error>;
}


## Stream

trait Stream {
/// The type of the value yielded by the stream.
type Item;

/// The type representing errors that occurred while processing the computation.
type Error;

/// The function that will be repeatedly called to see if the stream has
/// another value it can yield
fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error>;
}