mirror of
https://github.com/async-rs/async-std.git
synced 2025-01-31 01:35:33 +00:00
fix: Rename TimeoutStream to Timeout
This commit is contained in:
parent
10f32ca817
commit
c3f6f969c5
2 changed files with 8 additions and 8 deletions
|
@ -113,7 +113,7 @@ cfg_if! {
|
|||
use crate::stream::FromStream;
|
||||
|
||||
pub use merge::Merge;
|
||||
pub use timeout::TimeoutStream;
|
||||
pub use timeout::Timeout;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1074,11 +1074,11 @@ extension_trait! {
|
|||
"#]
|
||||
#[cfg(any(feature = "unstable", feature = "docs"))]
|
||||
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
|
||||
fn timeout(self, dur: Duration) -> TimeoutStream<Self>
|
||||
fn timeout(self, dur: Duration) -> Timeout<Self>
|
||||
where
|
||||
Self: Stream + Sized,
|
||||
{
|
||||
TimeoutStream::new(self, dur)
|
||||
Timeout::new(self, dur)
|
||||
}
|
||||
|
||||
#[doc = r#"
|
||||
|
|
|
@ -11,23 +11,23 @@ use crate::task::{Context, Poll};
|
|||
|
||||
#[doc(hidden)]
|
||||
#[derive(Debug)]
|
||||
pub struct TimeoutStream<S> {
|
||||
pub struct Timeout<S: Stream> {
|
||||
stream: S,
|
||||
delay: Delay,
|
||||
}
|
||||
|
||||
impl<S> TimeoutStream<S> {
|
||||
impl<S: Stream> Timeout<S> {
|
||||
pin_utils::unsafe_pinned!(stream: S);
|
||||
pin_utils::unsafe_pinned!(delay: Delay);
|
||||
|
||||
pub fn new(stream: S, dur: Duration) -> TimeoutStream<S> {
|
||||
pub fn new(stream: S, dur: Duration) -> Timeout<S> {
|
||||
let delay = Delay::new(dur);
|
||||
|
||||
TimeoutStream { stream, delay }
|
||||
Timeout { stream, delay }
|
||||
}
|
||||
}
|
||||
|
||||
impl<S: Stream> Stream for TimeoutStream<S> {
|
||||
impl<S: Stream> Stream for Timeout<S> {
|
||||
type Item = Result<S::Item, TimeoutError>;
|
||||
|
||||
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
|
||||
|
|
Loading…
Reference in a new issue