Allocator adaptors for building strings and vectors with shared ownership. #1138
Labels
T-lang
Relevant to the language team, which will review and decide on the RFC.
T-libs-api
Relevant to the library API team, which will review and decide on the RFC.
Assuming allocator support, and
P<T, A=Heap>
whereP<T>
is one ofBox<T>
,Rc<T>
,Vec<T>
,String
, etc.:There could be an
AsRc<A=Heap>
allocator adaptor, which leaves space for a refcount when allocating and resizing an allocation.We can then build a
String<AsRc>
, convert it toBox<str, AsRc>
and convert that toRc<str>
, without any redundant copies.This might also make an interesting alternative to polymorphic
box
:Rc::from(box foo)
would work even ifbox expr: Box<T, A>
(but it is even more verbose thanRc::new
).The text was updated successfully, but these errors were encountered: