forked from mirror/async-std
FromStream for ()
This commit is contained in:
parent
6ab154be7c
commit
6bc3cd0ab2
3 changed files with 23 additions and 0 deletions
|
@ -65,6 +65,7 @@ cfg_if! {
|
||||||
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
|
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
|
||||||
pub mod pin;
|
pub mod pin;
|
||||||
|
|
||||||
|
mod unit;
|
||||||
mod vec;
|
mod vec;
|
||||||
mod result;
|
mod result;
|
||||||
mod option;
|
mod option;
|
||||||
|
|
16
src/unit/from_stream.rs
Normal file
16
src/unit/from_stream.rs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
use std::pin::Pin;
|
||||||
|
|
||||||
|
use crate::prelude::*;
|
||||||
|
use crate::stream::{FromStream, IntoStream};
|
||||||
|
|
||||||
|
impl FromStream<()> for () {
|
||||||
|
#[inline]
|
||||||
|
fn from_stream<'a, S: IntoStream<Item = ()>>(
|
||||||
|
stream: S,
|
||||||
|
) -> Pin<Box<dyn core::future::Future<Output = Self> + 'a>>
|
||||||
|
where
|
||||||
|
<S as IntoStream>::IntoStream: 'a,
|
||||||
|
{
|
||||||
|
Box::pin(stream.into_stream().for_each(|_| ()))
|
||||||
|
}
|
||||||
|
}
|
6
src/unit/mod.rs
Normal file
6
src/unit/mod.rs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
//! The Rust primitive `()` type, sometimes called "unit" or "nil".
|
||||||
|
//!
|
||||||
|
//! This module provides types and implementations for working
|
||||||
|
//! asynchronously with values of type `()`.
|
||||||
|
|
||||||
|
mod from_stream;
|
Loading…
Reference in a new issue