Hey Guys!
I dont know how i could create an interator using std that clones another iterator, so it owns the values, but it should return the values as borrows.
I need this as i have an trait function that is supposed to return a boxed iterator that gives a referenced values of some specific type Box<dyn DoubleEndedIterator<Item = &MyValue + 'a>.
Some implementations are supposed to be able to return an iterator over some collection f.e. that is owned by the struct that implements the trait.
And some implementations are supposed to be able to return an iterator that owns these values as the collection might needs to be created "on demand".
I still want to support the former version to make it as optimized as possible without the need to clone the values.
So I can f.e. do something like:
fn foo<'a>() -> Box<dyn DoubleEndedIterator<Item = &MyValue + 'a>> {
vec![val1.clone(), val2.clone()].into_iter().give_me_refs()
}```