macro_rules! define_start_with_impl {
($($bounds:tt)*) => {
use alloc::vec::Vec;
use fluxion_core::StreamItem;
use futures::{stream::iter, Stream, StreamExt};
pub trait StartWithExt<T>: Stream<Item = StreamItem<T>> + Sized {
fn start_with(self, initial_values: Vec<StreamItem<T>>) -> impl Stream<Item = StreamItem<T>> + $($bounds)*;
}
impl<S, T> StartWithExt<T> for S
where
S: Stream<Item = StreamItem<T>> + $($bounds)*,
T: $($bounds)*,
{
fn start_with(self, initial_values: Vec<StreamItem<T>>) -> impl Stream<Item = StreamItem<T>> + $($bounds)* {
let initial_stream = iter(initial_values);
initial_stream.chain(self)
}
}
};
}