mirror of
https://github.com/async-rs/async-std.git
synced 2025-03-05 17:49:40 +00:00
Run rustfmt
This commit is contained in:
parent
95a3e53fcd
commit
8b662b659d
2 changed files with 16 additions and 17 deletions
|
@ -308,6 +308,7 @@ pub use once::{once, Once};
|
||||||
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::*;
|
||||||
|
pub use successor::{successor, Successor};
|
||||||
|
|
||||||
pub(crate) mod stream;
|
pub(crate) mod stream;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use std::pin::Pin;
|
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
use std::pin::Pin;
|
||||||
|
|
||||||
use crate::future::Future;
|
use crate::future::Future;
|
||||||
use crate::stream::Stream;
|
use crate::stream::Stream;
|
||||||
|
@ -13,12 +13,13 @@ use crate::task::{Context, Poll};
|
||||||
/// [`successor`]: fn.successor.html
|
/// [`successor`]: fn.successor.html
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Successor<F, Fut, T>
|
pub struct Successor<F, Fut, T>
|
||||||
where Fut: Future<Output=T>
|
where
|
||||||
|
Fut: Future<Output = T>,
|
||||||
{
|
{
|
||||||
successor: F,
|
successor: F,
|
||||||
future: Option<Fut>,
|
future: Option<Fut>,
|
||||||
next: T,
|
next: T,
|
||||||
_marker: PhantomData<Fut>
|
_marker: PhantomData<Fut>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new stream where to produce each new element a clousre is called with the previous
|
/// Creates a new stream where to produce each new element a clousre is called with the previous
|
||||||
|
@ -65,12 +66,10 @@ where
|
||||||
F: FnMut(T) -> Fut,
|
F: FnMut(T) -> Fut,
|
||||||
Fut: Future<Output = T>,
|
Fut: Future<Output = T>,
|
||||||
T: Copy,
|
T: Copy,
|
||||||
|
|
||||||
{
|
{
|
||||||
pin_utils::unsafe_unpinned!(successor: F);
|
pin_utils::unsafe_unpinned!(successor: F);
|
||||||
pin_utils::unsafe_unpinned!(next: T);
|
pin_utils::unsafe_unpinned!(next: T);
|
||||||
pin_utils::unsafe_pinned!(future: Option<Fut>);
|
pin_utils::unsafe_pinned!(future: Option<Fut>);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<F, Fut, T> Stream for Successor<F, Fut, T>
|
impl<F, Fut, T> Stream for Successor<F, Fut, T>
|
||||||
|
@ -88,7 +87,7 @@ where
|
||||||
let fut = (self.as_mut().successor())(x);
|
let fut = (self.as_mut().successor())(x);
|
||||||
self.as_mut().future().set(Some(fut));
|
self.as_mut().future().set(Some(fut));
|
||||||
}
|
}
|
||||||
_ => {},
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
let next = futures_core::ready!(self.as_mut().future().as_pin_mut().unwrap().poll(cx));
|
let next = futures_core::ready!(self.as_mut().future().as_pin_mut().unwrap().poll(cx));
|
||||||
|
@ -97,4 +96,3 @@ where
|
||||||
Poll::Ready(Some(next))
|
Poll::Ready(Some(next))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue