Closed Nuhvi closed 1 year ago
@dvc94ch You might want to take a look at this commit in particular as it creates a self referential struct that holds both the bytes of v
as well as the decoded Packet, so the fallible initialization is not delayed, self.packet()
then is always a valid Packet, if either from_bytes()
or from_packet()
were OK.
At least that was my goal, I might have did something wrong.
No idea, never used safecell before. Looks interesting. I generally just avoid using self referential structs
It was generously suggested by @rklaehn so I trust it is good, I might be using it wrong, but will merge this anyways as long as there is no obvious bug in it.
closes #13 or at least opens the chance for serious review.