Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pub trait CommitmentBounds:
}

#[cfg(not(feature = "serde"))]
trait CommitmentBounds: CommitmentBoundsSerdeless {}
pub trait CommitmentBounds: CommitmentBoundsSerdeless {}

impl<T> CommitmentBounds for Commitment<T> where T: Committable + 'static {}

Expand Down Expand Up @@ -153,6 +153,12 @@ impl<T: ?Sized + Committable> From<Commitment<T>> for [u8; 32] {
}
}

impl<T: ?Sized + Committable> From<[u8; 32]> for Commitment<T> {
fn from(array: [u8; 32]) -> Self {
Self(array, PhantomData)
}
}

impl<'a, T: ?Sized + Committable> Arbitrary<'a> for Commitment<T> {
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
Ok(Self(u.arbitrary()?, PhantomData))
Expand Down
Loading