screeps-game-api icon indicating copy to clipboard operation
screeps-game-api copied to clipboard

Manually implemented RawObjectId de/serialization to/from string

Open agg23 opened this issue 2 years ago • 1 comments

The standard serde de/serialize implementations stored the RawObjectId u128 as a limited precision number, such as 1.2193937513084523e+38. This custom implementation stores the value instead as a human readable string.

We could instead serialize this as a byte array for efficiency, but since the serde_json format is a lower efficiency mechanism anyway, I think defaulting to readability is better.

agg23 avatar Dec 02 '21 16:12 agg23

I would advise implementing human-readable versus compact formats as used in serde-rs/serde#1044 to allow human-readable while also using compact-encode during binary serialization.

Dessix avatar Apr 11 '22 20:04 Dessix