near / borsh-rs

Rust implementation of Binary Object Representation Serializer for Hashing
https://borsh.io/
Apache License 2.0
299 stars 65 forks source link

feat: impl `BorshSerialize`/`BorshDeserialize/BorshSchema` for `char` #248

Closed dj8yfo closed 10 months ago

dj8yfo commented 10 months ago

resolves #247

mina86 commented 10 months ago

FYI, Unicode character is 21-bit number. This could be optimised to encode as 3-byte little endian number. (Another alternative is to use UTF-8 which would be more in line with how strings are serialised).

frol commented 10 months ago

@mina86 Thanks for pointing that out. I have also raised a concern (https://github.com/near/borsh-rs/issues/247#issuecomment-1772172152) that maybe we should not implement it in borsh unless we strictly define what char is, and given that I have never needed to serialize char nor have I heard a request to do that, I would suggest we don't spend time here.