This is just braindump note to hear people’s opinions. I’ll write Pre-RFC about it soon.
Currently only way to create
let rc: Rc<[T]> = iter.collect::<Vec<T>>().into();
But this code copies entire contents of vector to rc’s buffer, as
Rc<[T]>'s heap layout is not compatible with
Implementing it as title says can be a bit trickier as
RcBox is not designed to be grow. Hopefully we can borrow most logic for it from
Maybe we can name this feature as
shared_from_iterator. It should also cover iterator of char/&str and Arc as well.
Reference: shared-from-slice RFC