FromStream for ()

staging
Sunjay Varma 5 years ago
parent 6ab154be7c
commit 6bc3cd0ab2

@ -65,6 +65,7 @@ cfg_if! {
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
pub mod pin;
mod unit;
mod vec;
mod result;
mod option;

@ -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(|_| ()))
}
}

@ -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…
Cancel
Save