You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, we still use bitvec in the subxt codegen stuff (we generate specific store/order things when we encounter bitvec types). As BitVec can't be compiled to wasm with every store type we support, this means we may occasionally generate code that doesn't compile to WASM. And anyway, we don't use bitvec elsewhere now so it'd be good to get rid of it from everywhere.
So let's figure out how to do this! Possibly something like:
pubenumU8{}pubenumU16{}// ...pubenumLsb0{}pubenumMsb0{}#[derive(Debug,Clone)]pubstructDecodedBits<Store,Order>(scale_bits::Bits)implDecodeforDecodedBits<U8,Lsb0>{// ... use scale_bits to do the heavy lifting }implDecodeforDecodedBits<U16,Lsb0>{// ... use scale_bits to do the heavy lifting }// ...// and then in the codegen, use those types in substitute, instead of swapping out the // bitvec store/order types to make valid bitvecs
This is a bit verbose of an approach; perhaps we can think of something simpler?
The text was updated successfully, but these errors were encountered:
I understand that BitVec<U64, ...> is the problematic type since the support in bitvec relies on cfg(target_pointer_width = "64") but we also want to always handle BitVec-style types in general. What about usize as a store type?
Do we want to forward more impls to the inner type or should we just expose the inner field for the consumer directly?
Fortunately, the only store types I think we need to care about are U8, U16, U32 and U64 as those are the types that parity_scale_codec::Decode and the bitvec::Store trait are implemented on iirc (people can create custom store and order types but shrug; I just want the default ones to be OK I guess!).
I'd probably just have the codegen expose publically the inner scale_bits::Bits type, and otherwise just support the basic traits on the wrapper type I guess to make it work OK in the codegen stuff :)
So maybe the type is more like pub struct DecodedBits<Store,Order>(pub scale_bits::Bits), and maybe that lives under the utils module in subxt and then subxt_codegen would end up generating code like:
Currently, we still use
bitvec
in the subxt codegen stuff (we generate specific store/order things when we encounter bitvec types). As BitVec can't be compiled to wasm with every store type we support, this means we may occasionally generate code that doesn't compile to WASM. And anyway, we don't use bitvec elsewhere now so it'd be good to get rid of it from everywhere.So let's figure out how to do this! Possibly something like:
This is a bit verbose of an approach; perhaps we can think of something simpler?
The text was updated successfully, but these errors were encountered: