This commit is contained in:
Henry de Valence 2019-12-03 13:39:26 -08:00
parent faebd2b783
commit 36b3842f3d
3 changed files with 15 additions and 7 deletions

View File

@ -1,6 +1,6 @@
use std::{convert::TryFrom, marker::PhantomData};
use crate::{Error, SigType, SpendAuth, Binding, Randomizer, Signature};
use crate::{Binding, Error, Randomizer, SigType, Signature, SpendAuth};
/// A refinement type indicating that the inner `[u8; 32]` represents an
/// encoding of a RedJubJub public key.
@ -12,7 +12,10 @@ pub struct PublicKeyBytes<T: SigType> {
impl<T: SigType> From<[u8; 32]> for PublicKeyBytes<T> {
fn from(bytes: [u8; 32]) -> PublicKeyBytes<T> {
PublicKeyBytes { bytes, _marker: PhantomData }
PublicKeyBytes {
bytes,
_marker: PhantomData,
}
}
}

View File

@ -1,6 +1,6 @@
use std::{convert::TryFrom, marker::PhantomData};
use crate::{Error, PublicKey, SigType, Binding, SpendAuth, Randomizer, Signature};
use crate::{Binding, Error, PublicKey, Randomizer, SigType, Signature, SpendAuth};
/// A refinement type indicating that the inner `[u8; 32]` represents an
/// encoding of a RedJubJub secret key.
@ -12,7 +12,10 @@ pub struct SecretKeyBytes<T: SigType> {
impl<T: SigType> From<[u8; 32]> for SecretKeyBytes<T> {
fn from(bytes: [u8; 32]) -> SecretKeyBytes<T> {
SecretKeyBytes{ bytes, _marker: PhantomData }
SecretKeyBytes {
bytes,
_marker: PhantomData,
}
}
}

View File

@ -1,4 +1,4 @@
use std::{marker::PhantomData, convert, fmt};
use std::{convert, fmt, marker::PhantomData};
use crate::SigType;
@ -11,7 +11,8 @@ pub struct Signature<T: SigType> {
impl<T: SigType> From<[u8; 64]> for Signature<T> {
fn from(bytes: [u8; 64]) -> Signature<T> {
Signature {
bytes, _marker: PhantomData,
bytes,
_marker: PhantomData,
}
}
}
@ -39,7 +40,8 @@ impl<T: SigType> Clone for Signature<T> {
let mut bytes = [0; 64];
bytes[..].copy_from_slice(&self.bytes[..]);
Signature {
bytes, _marker: PhantomData,
bytes,
_marker: PhantomData,
}
}
}