rbx_types Variant::String
should be backed by Vec<u8>
instead of String
#475
Labels
Variant::String
should be backed by Vec<u8>
instead of String
#475
Right now, rbx_types uses the Rust
String
type to represent Robloxstring
values. This works most of the time, but is actually incorrect because Roblox strings are not required to be UTF-8. So, rbx-dom is currently unable to losslessly decode files that have non UTF-8 string properties.The idea of using the bstr crate has been thrown around before, but after a bit of investigation, this won't work very well because BString's human-readable serde representation is always a list of numbers, which makes rbx-dom's various snapshot tests unreadable, and which will seriously bloat the JSON representation. We also cannot provide our own Serialize/Deserialize implementations for BString because of the orphan rule. We could just newtype it... but this somewhat nullifies the benefits of pulling in a crate!
So, to put the nail in the coffin on this, I'm thinking we'll have change rbx-dom's
String
variant so it is backed by a type that contains either aVec<u8>
or aString
, perhaps calledRobloxString
or something.Lastly, we've just had breaking changes to rbx_dom_weak. Breaking 2 different crates in rbx-dom at once might be a bit much to take on right now since we'll already have to make some fairly sweeping changes to Rojo, so this should probably wait until after rbx-dom's next batch of releases.
The text was updated successfully, but these errors were encountered: