uuid-rs / uuid

Generate and parse UUIDs.
https://www.crates.io/crates/uuid
Other
987 stars 191 forks source link

Add bitcode support #739

Open tbillington opened 7 months ago

tbillington commented 7 months ago

This pr adds support for bitcode, commonly used by bevy games for it's more compact representation.

KodrAus commented 6 months ago

Thanks for the PR @tbillington.

Since the bitcode library is unstable we can't add support to uuid without also requiring the uuid_unstable rustflag be set too. The zerocopy support has an example of how to do this. Needing to set a flag at build-time makes these unstable features largely unsuitable for libraries, but can be used by applications that are willing to opt-in to it.

Would you be happy to add the extra uuid_unstable cfg to this?

tbillington commented 6 months ago

Oh interesting, I can look into that 👍

When you say the library in unstable, what exactly do you mean?

KodrAus commented 6 months ago

Ah I just mean that the library is pre-1.0, so breaking changes are still expected. If the library does make breaking changes then we'll either need to make a breaking change in uuid too to adopt it, or create another feature to support it. Having the unstable opt-in RUSTFLAG is a balance between adding support for new libraries, and insulating uuid from breaking changes in its dependencies.

caibear commented 4 months ago

Another solution is to specify bitcode = { version = "0", features = ["derive"], default-features = false, optional = true } and only use #[derive(Encode, Decode)]. These apis are considered a stable subset of bitcode. Then users of uuid can choose the major version of bitcode.

tbillington commented 4 months ago

Happy to make the change caibear suggested, would that still require uuid_unstable?

KodrAus commented 4 months ago

Hmm, I wouldn't be comfortable taking on this kind of stability policy in uuid. I'd be more than happy to accept this under the same unstable policy as zerocopy though.

vnghia commented 3 weeks ago

Hello I've created a PR to add support for UUID in bitcode. I think it is better if we add the support there instead of here. https://github.com/SoftbearStudios/bitcode/pull/34