EncodedPoint should be Copy/Clone.

This commit is contained in:
Sean Bowe 2017-07-17 13:05:16 -06:00
parent 7b1cd7f211
commit d67109d5d3
No known key found for this signature in database
GPG Key ID: 95684257D8F8B031
2 changed files with 30 additions and 0 deletions

View File

@ -579,8 +579,15 @@ pub mod g1 {
curve_impl!("E", G1, G1Affine, G1Prepared, Fq, Fr, G1Uncompressed, G1Compressed);
#[derive(Copy)]
pub struct G1Uncompressed([u8; 96]);
impl Clone for G1Uncompressed {
fn clone(&self) -> G1Uncompressed {
G1Uncompressed(self.0)
}
}
impl AsRef<[u8]> for G1Uncompressed {
fn as_ref(&self) -> &[u8] {
&self.0
@ -688,8 +695,15 @@ pub mod g1 {
}
}
#[derive(Copy)]
pub struct G1Compressed([u8; 48]);
impl Clone for G1Compressed {
fn clone(&self) -> G1Compressed {
G1Compressed(self.0)
}
}
impl AsRef<[u8]> for G1Compressed {
fn as_ref(&self) -> &[u8] {
&self.0
@ -1135,8 +1149,15 @@ pub mod g2 {
curve_impl!("E'", G2, G2Affine, G2Prepared, Fq2, Fr, G2Uncompressed, G2Compressed);
#[derive(Copy)]
pub struct G2Uncompressed([u8; 192]);
impl Clone for G2Uncompressed {
fn clone(&self) -> G2Uncompressed {
G2Uncompressed(self.0)
}
}
impl AsRef<[u8]> for G2Uncompressed {
fn as_ref(&self) -> &[u8] {
&self.0
@ -1268,8 +1289,15 @@ pub mod g2 {
}
}
#[derive(Copy)]
pub struct G2Compressed([u8; 96]);
impl Clone for G2Compressed {
fn clone(&self) -> G2Compressed {
G2Compressed(self.0)
}
}
impl AsRef<[u8]> for G2Compressed {
fn as_ref(&self) -> &[u8] {
&self.0

View File

@ -213,6 +213,8 @@ pub trait EncodedPoint: Sized +
Sync +
AsRef<[u8]> +
AsMut<[u8]> +
Clone +
Copy +
'static
{
type Affine: CurveAffine;