Skip to content

Commit

Permalink
move into impl
Browse files Browse the repository at this point in the history
  • Loading branch information
ss-es committed Aug 16, 2024
1 parent 84328b2 commit 9e0d63d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ impl<T: ?Sized + Committable> Commitment<T> {
pub fn into_bits(self) -> BitVec<u8, bitvec::order::Lsb0> {
BitVec::try_from(self.0.to_vec()).unwrap()
}

pub fn from_raw(bytes: [u8; 32]) -> Self {
Self(bytes, PhantomData)
}
}

// clippy pacification: `non_canonical_clone_impl` aka `incorrect_clone_impl_on_copy_type`
Expand All @@ -153,10 +157,6 @@ impl<T: ?Sized + Committable> From<Commitment<T>> for [u8; 32] {
}
}

pub fn from_raw<T: ?Sized + Committable>(bytes: [u8; 32]) -> Commitment<T> {
Commitment(bytes, 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

0 comments on commit 9e0d63d

Please sign in to comment.