dusk-network / piecrust

General purpose virtual machine for running WASM smart contracts
Mozilla Public License 2.0
22 stars 13 forks source link

Add `impl PartialEq<[u8; 32]> for ContractId` #375

Closed ureeves closed 2 months ago

ureeves commented 2 months ago

Summary

Implementing the PartialEq trait, and its permutations, for [u8; 32] and ContractId will allow for downstream comparisons that now have to go through the ContractId::to_bytes or ContractId::from_bytes functions to be much more concise and easy to read.

Possible Solution (optional)

impl PartialEq<[u8; 32]> for ContractId
impl PartialEq<ContractId> for [u8; 32] // if possible
// to consider
impl<'a, 'b> PartialEq<&'b [u8; 32]> for &'a ContractId
impl<'a> PartialEq<[u8; 32]> for &'a ContractId
// ...