~tdeo/serde_bare#6: 
Serialize Uint type

Hey, this is more of a question than a ticket but I need to serialise some structs to have variable length number types in the generated binary. I see that serde_bare exposes a Uint type, but I don't see an obvious way to use it.

Is this possible with serde_bare? If so, what am I missing?

Thanks!

Status
REPORTED
Submitter
~spacekookie
Assigned to
No-one
Submitted
3 years ago
Updated
10 months ago
Labels
No labels applied.

~tdeo 3 years ago

Hi, sorry for not replying for this long.

The Uint type is meant to be used like any other integer type, like u64. You can embed it inside a struct, and then create a value for it with Uint(value).

~chiefnoah 10 months ago*

Can we implement Deref and From for Int and UInt to easily convert between their inner types?

~chiefnoah 10 months ago

I'm happy to send some patches

~tdeo 10 months ago

#From seems good, but I'm not sure about Deref - see https://rust-lang.github.io/api-guidelines/predictability.html#c-deref

Tadeo

On Sun, Apr 21, 2024, at 12:10, ~chiefnoah wrote:

I'm happy to send some patches

-- View on the web: https://todo.sr.ht/~tdeo/serde_bare/6#event-346841

~tdeo referenced this from #6 10 months ago

~chiefnoah 10 months ago

Oh, wasn't aware of the Deref recommendations. Just From then.

Register here or Log in to comment, or comment via email.