Skip to content

Commit

Permalink
fix(bitfield): make pair_with work with other bitfields (#295)
Browse files Browse the repository at this point in the history
This adds a generic parameter to `Pack{N}::pair_with` so that a pair can
be created between packing spec defined on two different generated
bitfield types.
  • Loading branch information
hawkw committed Aug 10, 2022
1 parent cff7467 commit 532ee98
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bitfield/src/pack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ macro_rules! make_packers {
///
/// The two ranges must be the same size. This can be asserted
/// by the `assert_valid` method on the returned pair type.
pub const fn pair_with(&self, dst: Self) -> $Pair<T> {
pub const fn pair_with<F2>(&self, dst: $Pack<T, F2>) -> $Pair<T> {
// TODO(eliza): validate that `dst.shift + self.bits() < N_BITS` in
// const fn somehow lol
let (dst_shl, dst_shr) = if dst.shift > self.shift {
Expand Down

0 comments on commit 532ee98

Please sign in to comment.