Skip to content

Commit 6b5d260

Browse files
authored
Update bitvec to 1.0 version (#137)
* Update bitvec to 1.0 version * Update bit-vec 1.0 * Better Order
1 parent 7352c4d commit 6b5d260

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ categories = ["no-std", "encoding"]
1414
include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"]
1515

1616
[dependencies]
17-
bitvec = { version = "0.20.1", default-features = false, features = ["alloc"], optional = true }
17+
bitvec = { version = "1", default-features = false, features = ["alloc"], optional = true }
1818
cfg-if = "1.0"
1919
scale-info-derive = { version = "1.0.0", path = "derive", default-features = false, optional = true }
2020
serde = { version = "1", default-features = false, optional = true, features = ["derive", "alloc"] }

src/impls.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,15 +390,15 @@ where
390390
mod bit_vec {
391391
use super::*;
392392

393-
impl<O, T> TypeInfo for bitvec::vec::BitVec<O, T>
393+
impl<T, O> TypeInfo for bitvec::vec::BitVec<T, O>
394394
where
395-
O: bitvec::order::BitOrder + TypeInfo + 'static,
396395
T: bitvec::store::BitStore + TypeInfo + 'static,
396+
O: bitvec::order::BitOrder + TypeInfo + 'static,
397397
{
398398
type Identity = Self;
399399

400400
fn type_info() -> Type {
401-
crate::TypeDefBitSequence::new::<O, T>().into()
401+
crate::TypeDefBitSequence::new::<T, O>().into()
402402
}
403403
}
404404

src/tests.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,18 +152,18 @@ fn bitvec() {
152152
};
153153

154154
assert_type!(
155-
BitVec<Lsb0, u8>,
156-
TypeDefBitSequence::new::<Lsb0, u8>()
155+
BitVec<u8,Lsb0>,
156+
TypeDefBitSequence::new::<u8,Lsb0>()
157157
);
158158

159159
assert_type!(
160-
BitVec<Msb0, u16>,
161-
TypeDefBitSequence::new::<Msb0, u16>()
160+
BitVec<u16,Msb0>,
161+
TypeDefBitSequence::new::<u16,Msb0>()
162162
);
163163

164164
assert_type!(
165-
BitVec<Msb0, u32>,
166-
TypeDefBitSequence::new::<Msb0, u32>()
165+
BitVec<u32,Msb0>,
166+
TypeDefBitSequence::new::<u32,Msb0>()
167167
);
168168
}
169169

src/ty/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -544,19 +544,19 @@ where
544544
#[cfg_attr(any(feature = "std", feature = "decode"), derive(scale::Decode))]
545545
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Encode, Debug)]
546546
pub struct TypeDefBitSequence<T: Form = MetaForm> {
547-
/// The type implementing [`bitvec::store::BitStore`].
548-
bit_store_type: T::Type,
549547
/// The type implementing [`bitvec::order::BitOrder`].
550548
bit_order_type: T::Type,
549+
/// The type implementing [`bitvec::store::BitStore`].
550+
bit_store_type: T::Type,
551551
}
552552

553553
impl IntoPortable for TypeDefBitSequence {
554554
type Output = TypeDefBitSequence<PortableForm>;
555555

556556
fn into_portable(self, registry: &mut Registry) -> Self::Output {
557557
TypeDefBitSequence {
558-
bit_store_type: registry.register_type(&self.bit_store_type),
559558
bit_order_type: registry.register_type(&self.bit_order_type),
559+
bit_store_type: registry.register_type(&self.bit_store_type),
560560
}
561561
}
562562
}
@@ -579,14 +579,14 @@ where
579579
#[cfg(feature = "bit-vec")]
580580
impl TypeDefBitSequence {
581581
/// Creates a new [`TypeDefBitSequence`] for the supplied bit order and bit store types.
582-
pub fn new<O, T>() -> Self
582+
pub fn new<T, O>() -> Self
583583
where
584-
O: bitvec::order::BitOrder + TypeInfo + 'static,
585584
T: bitvec::store::BitStore + TypeInfo + 'static,
585+
O: bitvec::order::BitOrder + TypeInfo + 'static,
586586
{
587587
Self {
588-
bit_order_type: MetaType::new::<O>(),
589588
bit_store_type: MetaType::new::<T>(),
589+
bit_order_type: MetaType::new::<O>(),
590590
}
591591
}
592592
}

0 commit comments

Comments
 (0)