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

Update ArrayString to use union and prepare for 0.5 #116

Merged
merged 7 commits into from
Dec 18, 2018

Conversation

bluss
Copy link
Owner

@bluss bluss commented Dec 16, 2018

  • Use union in ArrayString, since it only has a Copy backing array. Unfortunately we have to copy this bound to all where clauses of an ArrayString, but we now have the proper solution in place.. for ArrayString.
  • Remove unused raw pointer accessors on the Array trait, but add associated constant for size for future proofing

This isn't of much use at the moment, but future Rust features could
mean we can use it.
Raw pointer taking should go through the MaybeUninit wrappers around the
arrays anyway, when it is partially uninitialized, which it often is.

The remaining .as_ptr() and .as_slice() methods on Array is only used
on a fully initialized array in ArrayString::from_byte_string
This is the "real" union solution, and ArrayString can use it since its
backing array is Copy. Unfortunately, we'll have to use the Copy bound
on the type, making it "viral" and visible in the user API.
@bluss bluss force-pushed the maybe-uninit-for-0.5 branch 4 times, most recently from 33952cf to 1ecbea9 Compare December 16, 2018 22:41
Rust 1.24 is on debian stable. It is compatible with crossbeam (Rust 1.26),
the rdep with most downloads.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant