Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR, not to be merged without some consideration, adds a new helper crate
bytes
meant to resemble the crates.io bytes crate, but with substantially less complexity, at least one additional feature (recovering resources) and perhaps a great deal less safety (totally unclear to me).There are two modules,
rc
andarc
, which sequester a byte allocation behind anRc
orArc
, respectively. The type returns access to the underlying allocation only when it is able to destructure the reference usingtry_unwrap
, which intends to ensure that there are no outstanding instances referencing the allocation (other than the one being consumed).The intended benefit here is that we can slice up some bytes like
split_at_mut
and hand out independent mutable regions as long as they are disjoint, which the interface means to ensure.I think this PR will sit here for a while until I figure out how one increases the confidence in unsafe code, other than pointing Rust people at it and seeing whether they nod or sigh.