Skip to content

Commit fdff330

Browse files
authored
elliptic-curve: add explicit Copy impl for PublicKey (#379)
The derived impl appears to have the incorrect bounds
1 parent ea5106e commit fdff330

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

elliptic-curve/src/public_key.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use generic_array::ArrayLength;
2020
///
2121
/// These are a thin wrapper around [`AffinePoint`] which simplifies
2222
/// encoding/decoding.
23-
#[derive(Copy, Clone, Debug)]
23+
#[derive(Clone, Debug)]
2424
pub struct PublicKey<C>
2525
where
2626
C: Curve + ProjectiveArithmetic,
@@ -185,6 +185,15 @@ where
185185
}
186186
}
187187

188+
impl<C> Copy for PublicKey<C>
189+
where
190+
C: Curve + ProjectiveArithmetic,
191+
FieldBytes<C>: From<Scalar<C>> + for<'r> From<&'r Scalar<C>>,
192+
Scalar<C>: PrimeField<Repr = FieldBytes<C>>,
193+
AffinePoint<C>: Copy + Clone + Debug,
194+
{
195+
}
196+
188197
impl<C> Eq for PublicKey<C>
189198
where
190199
C: Curve + ProjectiveArithmetic,

0 commit comments

Comments
 (0)