2
0
Fork 1
mirror of https://github.com/async-rs/async-std.git synced 2025-04-13 11:56:43 +00:00
This commit is contained in:
Yosh 2025-03-19 07:16:53 +01:00 committed by GitHub
commit 719d50235b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 15 additions and 12 deletions

View file

@ -41,8 +41,6 @@ use crate::utils::{timer_after, Timer};
/// # /// #
/// # Ok(()) }) } /// # Ok(()) }) }
/// ``` /// ```
#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
pub fn interval(dur: Duration) -> Interval { pub fn interval(dur: Duration) -> Interval {
Interval { Interval {
delay: timer_after(dur), delay: timer_after(dur),
@ -56,8 +54,6 @@ pub fn interval(dur: Duration) -> Interval {
/// documentation for more. /// documentation for more.
/// ///
/// [`interval`]: fn.interval.html /// [`interval`]: fn.interval.html
#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
#[derive(Debug)] #[derive(Debug)]
pub struct Interval { pub struct Interval {
delay: Timer, delay: Timer,

View file

@ -309,7 +309,9 @@
pub use empty::{empty, Empty}; pub use empty::{empty, Empty};
pub use from_fn::{from_fn, FromFn}; pub use from_fn::{from_fn, FromFn};
pub use from_iter::{from_iter, FromIter}; pub use from_iter::{from_iter, FromIter};
pub use interval::{interval, Interval};
pub use once::{once, Once}; pub use once::{once, Once};
pub use pending::{pending, Pending};
pub use repeat::{repeat, Repeat}; pub use repeat::{repeat, Repeat};
pub use repeat_with::{repeat_with, RepeatWith}; pub use repeat_with::{repeat_with, RepeatWith};
pub use stream::*; pub use stream::*;
@ -319,7 +321,9 @@ pub(crate) mod stream;
mod empty; mod empty;
mod from_fn; mod from_fn;
mod from_iter; mod from_iter;
mod interval;
mod once; mod once;
mod pending;
mod repeat; mod repeat;
mod repeat_with; mod repeat_with;
@ -329,9 +333,7 @@ cfg_unstable! {
mod extend; mod extend;
mod from_stream; mod from_stream;
mod fused_stream; mod fused_stream;
mod interval;
mod into_stream; mod into_stream;
mod pending;
mod product; mod product;
mod successors; mod successors;
mod sum; mod sum;
@ -341,11 +343,8 @@ cfg_unstable! {
pub use extend::{extend, Extend}; pub use extend::{extend, Extend};
pub use from_stream::FromStream; pub use from_stream::FromStream;
pub use fused_stream::FusedStream; pub use fused_stream::FusedStream;
pub use interval::{interval, Interval};
pub use into_stream::IntoStream; pub use into_stream::IntoStream;
pub use pending::{pending, Pending};
pub use product::Product; pub use product::Product;
pub use stream::Merge;
pub use successors::{successors, Successors}; pub use successors::{successors, Successors};
pub use sum::Sum; pub use sum::Sum;
} }

View file

@ -2,7 +2,11 @@ use core::marker::PhantomData;
use core::pin::Pin; use core::pin::Pin;
use core::task::{Context, Poll}; use core::task::{Context, Poll};
use crate::stream::{DoubleEndedStream, ExactSizeStream, FusedStream, Stream}; cfg_unstable! {
use crate::stream::{DoubleEndedStream, ExactSizeStream, FusedStream};
}
use crate::stream::Stream;
/// A stream that never returns any items. /// A stream that never returns any items.
/// ///
@ -53,14 +57,20 @@ impl<T> Stream for Pending<T> {
} }
} }
#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
impl<T> DoubleEndedStream for Pending<T> { impl<T> DoubleEndedStream for Pending<T> {
fn poll_next_back(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Option<T>> { fn poll_next_back(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Option<T>> {
Poll::Pending Poll::Pending
} }
} }
#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
impl<T> FusedStream for Pending<T> {} impl<T> FusedStream for Pending<T> {}
#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
impl<T> ExactSizeStream for Pending<T> { impl<T> ExactSizeStream for Pending<T> {
fn len(&self) -> usize { fn len(&self) -> usize {
0 0

View file

@ -16,8 +16,6 @@ pin_project! {
/// ///
/// [`merge`]: trait.Stream.html#method.merge /// [`merge`]: trait.Stream.html#method.merge
/// [`Stream`]: trait.Stream.html /// [`Stream`]: trait.Stream.html
#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
#[derive(Debug)] #[derive(Debug)]
pub struct Merge<L, R> { pub struct Merge<L, R> {
#[pin] #[pin]