I have a function that retures stream::iter_ok::<Response<String>>, io::Error>, what should be the function signature?

Hi there, I have a function that retures stream::iter_ok::<Response<String>>, io::Error>, what should be the function signature? I tried dyn futures::stream::Stream<Item = Response<String>, Error = io::Error> + 'static but I got error
 
fn handle_register(req: Request<()>) -> dyn futures::stream::Stream<Item = Response<String>, Error = io::Error> + 'static {
    let mut res = Response::builder();
    res.header("xhead", req.headers().get("xhead").unwrap().clone());
    let res = res.body("".to_string()).unwrap();
    stream::iter_ok::<_, io::Error>(vec![res])
}
You already invited:

Sharun - be myself

Upvotes from:

impl futures::stream::Stream<Item = ...etc...> should do it
dyn only works like &dyn Stream or Box<dyn Stream>... you could Box<dyn Stream<Item = ...etc...>> if you wanted

If you wanna answer this question please Login or Register