Open HadrienG2 opened 5 years ago
I have pushed a draft of the Abomonation<'bytes>
memory safety fix that we discussed in #27 , but it has a bunch of FIXMEs that I hope to improve upon before merging.
Alright, I think this one is now ready to go (though by virtue of being on the top of the PR stack, it will probably go in last).
This PR implements
Abomonation
for most references types, and a few DSTs along the way. It is what I had in mind while opening #27 . The main advantage of implementingAbomonation
for these types is that it becomes much easier to serialize types containing Rust references (which are, after all, almost like every other pointer).This PR raises a few questions that we may want to discuss here:
Abomonation
DST impls of this PR are only here 1/as a fun experiment and 2/because they are a more convenient place for deduplicating impls than free functions)Abomonation
, then we'll also need to makeencode
/decode
/measure
and tests acceptT: ?Sized
, which from a quick attempt won't be so easy. We may also want?Sized
bounds on some genericAbomonation
impls like that ofBox<T>
Abomonation
fordyn Trait
and&[mut] dyn Trait
whereTrait: Abomonation
?For convenience reasons, this PR is based on #22, #24, #25 and #26. Reviewing these PRs first is recommended, but if you want to review this one in isolation, please consider doing so commit-by-commit in order to get a clean diff.
Fixes #27 .