pubky / pkarr

Public Key Addressable Resource Records (sovereign TLDs)
https://app.pkarr.org
MIT License
166 stars 17 forks source link

HTTP client in Rust #20

Closed Nuhvi closed 1 year ago

Nuhvi commented 1 year ago

closes #13 or at least opens the chance for serious review.

Nuhvi commented 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.

dvc94ch commented 1 year ago

No idea, never used safecell before. Looks interesting. I generally just avoid using self referential structs

Nuhvi commented 1 year ago

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.