New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove requirement on bitvec for std feature and constructing TypeDefBitSequence. #168
Changes from 5 commits
ee718c0
30f093f
31748e4
6aedf4f
033578c
c96abd4
3804c26
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -576,17 +576,21 @@ where | |
} | ||
} | ||
|
||
#[cfg(feature = "bit-vec")] | ||
impl TypeDefBitSequence { | ||
/// Creates a new [`TypeDefBitSequence`] for the supplied bit order and bit store types. | ||
pub fn new<T, O>() -> Self | ||
/// | ||
/// With the `bit-vec` feature enabled, the expected usage is to provide either | ||
/// `bitvec::order::Lsb0` or `bitvec::order::Msb0` as the order type, and then something | ||
/// like u8, u8, or u32 as the store type. Without the `bit-vec` feature enabled, it's | ||
/// recommended that your types have identical `TypeInfo` to those. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. …or else? :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean, in theory it can be whatever it wants; it's just that our current tooling won't know how to decode the thing if the types don't line up with what we expect (no reason somebody else can't make tooling that can support more exotic types though if they want to go that route) |
||
pub fn new<Store, Order>() -> Self | ||
where | ||
T: bitvec::store::BitStore + TypeInfo + 'static, | ||
O: bitvec::order::BitOrder + TypeInfo + 'static, | ||
Store: TypeInfo + 'static, | ||
Order: TypeInfo + 'static, | ||
{ | ||
Self { | ||
bit_store_type: MetaType::new::<T>(), | ||
bit_order_type: MetaType::new::<O>(), | ||
bit_store_type: MetaType::new::<Store>(), | ||
bit_order_type: MetaType::new::<Order>(), | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bitvec crate will no longer be pulled in when "std" is enabled, but this I think makes no difference to the external interface since bitvec additions are behind the separate "bit-vec" feature anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that
bitvec
will still ultimately be pulled in viascale/std
https://github.com/paritytech/parity-scale-codec/blob/b5f2b360e2939e8a235423f40591db09e879fdbb/Cargo.toml#L41There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooh ok; I'll do a quick follow PR there then to prevent that :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR for parity-scale-codec thing: paritytech/parity-scale-codec#375