screeps-game-api
screeps-game-api copied to clipboard
Manually implemented RawObjectId de/serialization to/from string
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.
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.