dtolnay / typetag

Serde serializable and deserializable trait objects
Apache License 2.0
1.19k stars 38 forks source link

Switch from `inventory` to `linkme` for wider platform support #15

Closed kabergstrom closed 1 year ago

kabergstrom commented 5 years ago

If added support for WASM in linkme becomes a reality I think it may make sense to switch typetag to using linkme in its implementation rather than inventory. As far as I can tell, it should be possible if the internal inventory::submit! calls can be const expressions, and it should not affect the public API?

dtolnay commented 4 years ago

16 has the beginning of an implementation but is going to need someone to pick it up.

LLBlumire commented 1 year ago

It would be absolutely amazing to get this crate working on WASM, and would save me a huge amount of pain! I'm trying to look into what needs to be done and have ended up a little lost.

This issue seems to imply that just switching to linkme should be enough, and that it's already possible, but the linkme crate has this issue:

https://github.com/dtolnay/linkme/issues/6

Implying it doesn't yet have WASM support. In addition to this, the comments here and here make me feel like there may be fundamental design issues and the solution may lie in getting WASM support into inventories.

Inventories WASM support would require ctors to support it, where we have the following:

https://github.com/mmastrac/rust-ctor/issues/14

Which is blocked on:

https://github.com/rustwasm/wasm-bindgen/issues/1216

Which hasn't seen any update in 2 years now.

It seems to me a huge number of these issues are spawned by different people with different approaches trying to get typetag to work on WASM. This is clearly hugely desirable and I'm just trying to understand where the block actually is on doing this, so that I can not waste development effort trying to add support through the wrong dependencies!

Any pointers or advice on how this may practically be achieved currently, or what technical problem is the real roadblock of all those discussed, would be greatly appreciated!

dtolnay commented 1 year ago

I'll close this issue since as you observed, it's based on a false premise that linkme would convey broader platform support than the current implementation of this crate. Another issue can be opened later if that becomes the case at some point.