mirror of https://github.com/KaiserY/trpl-zh-cn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
369 B
21 lines
369 B
use std::pin::Pin;
|
|
use std::task::{Context, Poll};
|
|
|
|
trait Stream {
|
|
type Item;
|
|
fn poll_next(
|
|
self: Pin<&mut Self>,
|
|
cx: &mut Context<'_>,
|
|
) -> Poll<Option<Self::Item>>;
|
|
}
|
|
|
|
// ANCHOR: here
|
|
trait StreamExt: Stream {
|
|
async fn next(&mut self) -> Option<Self::Item>
|
|
where
|
|
Self: Unpin;
|
|
|
|
// other methods...
|
|
}
|
|
// ANCHOR_END: here
|