uuid icon indicating copy to clipboard operation
uuid copied to clipboard

Add bitcode support

Open tbillington opened this issue 1 year ago • 7 comments

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

tbillington avatar Feb 16 '24 09:02 tbillington

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?

KodrAus avatar Mar 03 '24 22:03 KodrAus

Oh interesting, I can look into that 👍

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

tbillington avatar Mar 03 '24 23:03 tbillington

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.

KodrAus avatar Mar 04 '24 00:03 KodrAus

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.

caibear avatar Apr 28 '24 11:04 caibear

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

tbillington avatar May 02 '24 00:05 tbillington

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.

KodrAus avatar May 06 '24 21:05 KodrAus