Enstream

Convert Future to Stream in a simple and lightweight manner.

Crate is fully compatible with #![no_std].

Example usage

```rust

![feature(genericassociatedtypes, typealiasimpl_trait)]

use std::future::Future;

use enstream::{HandlerFn, Yielder, enstream}; use futuresutil::{future::FutureExt, pinmut, stream::StreamExt};

struct StreamState<'a> { val: &'a str }

type StreamStateFut<'yielder> = impl Future

impl<'a> HandlerFn<'a, &'a str> for StreamState<'a> { type Fut<'yielder> = StreamStateFut<'yielder> where 'a: 'yielder;

fn call<'yielder>(self, mut yielder: Yielder<'yielder, &'a str>) -> Self::Fut<'yielder>
where
    'a: 'yielder
{
    async move {
        yielder.yield_item(self.val).await;
    }
}

}

let owned = String::from("test");

let stream = enstream(StreamState { val: &owned });

pin_mut!(stream);

asserteq!(stream.next().nowor_never().flatten(), Some("test")); ```