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

Add support for `RefBox<'a, [T]>` and `RefBox<'a, str>` #34

Closed
reem opened this issue Apr 30, 2015 · 5 comments
Closed

Add support for `RefBox<'a, [T]>` and `RefBox<'a, str>` #34

reem opened this issue Apr 30, 2015 · 5 comments

Comments

@reem
Copy link
Contributor

@reem reem commented Apr 30, 2015

These are useful for conservatively serializing &str and &[T] then deserializing to Box<str> and Box<[T]>, which are analogous to String and Vec<u8>.

@reem
Copy link
Contributor Author

@reem reem commented Apr 30, 2015

@TyOverby
Copy link
Collaborator

@TyOverby TyOverby commented Apr 30, 2015

I'm not familiar with boxed unsized types. How does one go about making and using Box and Box<[T]>?

@reem
Copy link
Contributor Author

@reem reem commented May 1, 2015

Box<[T]> is constructed via either box static_array or Vec::into_boxed_slice. It has the same representation as &[T] but is heap allocated and owned.

@reem
Copy link
Contributor Author

@reem reem commented May 1, 2015

You could also solve this issue with specific RefVec<'a, T> and RefString<'a> types, if the boxed-unsized-types is weird.

@TyOverby
Copy link
Collaborator

@TyOverby TyOverby commented May 2, 2015

#37 Will close this issue once I add tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.