use std::borrow::Cow; use std::pin::Pin; use crate::prelude::*; use crate::stream::{self, FromStream, IntoStream}; impl FromStream for String { #[inline] fn from_stream<'a, S: IntoStream + 'a>( stream: S, ) -> Pin + 'a + Send>> where ::IntoStream: Send, { let stream = stream.into_stream(); Box::pin(async move { let mut out = String::new(); stream::extend(&mut out, stream).await; out }) } } impl<'b> FromStream<&'b char> for String { #[inline] fn from_stream<'a, S: IntoStream + 'a>( stream: S, ) -> Pin + 'a + Send>> where ::IntoStream: Send, { let stream = stream.into_stream(); Box::pin(async move { let mut out = String::new(); stream::extend(&mut out, stream).await; out }) } } impl<'b> FromStream<&'b str> for String { #[inline] fn from_stream<'a, S: IntoStream + 'a>( stream: S, ) -> Pin + 'a + Send>> where ::IntoStream: Send, { let stream = stream.into_stream(); Box::pin(async move { let mut out = String::new(); stream::extend(&mut out, stream).await; out }) } } impl FromStream for String { #[inline] fn from_stream<'a, S: IntoStream + 'a>( stream: S, ) -> Pin + 'a + Send>> where ::IntoStream: Send, { let stream = stream.into_stream(); Box::pin(async move { let mut out = String::new(); stream::extend(&mut out, stream).await; out }) } } impl<'b> FromStream> for String { #[inline] fn from_stream<'a, S: IntoStream> + 'a>( stream: S, ) -> Pin + 'a + Send>> where ::IntoStream: Send, { let stream = stream.into_stream(); Box::pin(async move { let mut out = String::new(); stream::extend(&mut out, stream).await; out }) } }