Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allocator adaptors for building strings and vectors with shared ownership. #1138

Open
eddyb opened this issue May 30, 2015 · 1 comment
Open
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.

Comments

@eddyb
Copy link
Member

eddyb commented May 30, 2015

Assuming allocator support, and P<T, A=Heap> where P<T> is one of Box<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 to Box<str, AsRc> and convert that to Rc<str>, without any redundant copies.

This might also make an interesting alternative to polymorphic box: Rc::from(box foo) would work even if box expr: Box<T, A> (but it is even more verbose than Rc::new).

@eddyb
Copy link
Member Author

eddyb commented May 30, 2015

cc @pnkfelix

@nrc nrc added 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. labels Aug 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

2 participants