Skip to content

Commit

Permalink
add debug impls
Browse files Browse the repository at this point in the history
  • Loading branch information
NikVolf committed Apr 2, 2019
1 parent 8cb6e45 commit b3e4733
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/groups/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub trait GroupElement
fn double(&self) -> Self;
}

pub trait GroupParams: Sized {
pub trait GroupParams: Sized + fmt::Debug {
#[cfg(feature = "rustc-serialize")]
type Base: FieldElement + Decodable + Encodable;
#[cfg(not(feature = "rustc-serialize"))]
Expand Down Expand Up @@ -76,6 +76,7 @@ impl<P: GroupParams> G<P> {
}
}

#[derive(Debug)]
pub struct AffineG<P: GroupParams> {
x: P::Base,
y: P::Base,
Expand Down Expand Up @@ -415,6 +416,7 @@ impl<P: GroupParams> Sub<G<P>> for G<P> {
}
}

#[derive(Debug)]
pub struct G1Params;

impl GroupParams for G1Params {
Expand Down Expand Up @@ -451,6 +453,7 @@ pub type G1 = G<G1Params>;

pub type AffineG1 = AffineG<G1Params>;

#[derive(Debug)]
pub struct G2Params;

impl GroupParams for G2Params {
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ pub trait Group
fn normalize(&mut self);
}

#[derive(Copy, Clone, PartialEq, Eq)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "rustc-serialize", derive(RustcDecodable, RustcEncodable))]
#[repr(C)]
pub struct G1(groups::G1);
Expand Down Expand Up @@ -379,7 +379,7 @@ impl Mul<Fr> for G1 {
}
}

#[derive(Copy, Clone, PartialEq, Eq)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "rustc-serialize", derive(RustcDecodable, RustcEncodable))]
#[repr(C)]
pub struct AffineG1(groups::AffineG1);
Expand Down

0 comments on commit b3e4733

Please sign in to comment.