Skip to content

Commit

Permalink
Merge pull request #376 from dusk-network/contract-id-cmp
Browse files Browse the repository at this point in the history
uplink: add `impl PartialEq<[u8; 32]> for ContractId`
  • Loading branch information
Eduardo Leegwater Simões authored Jul 29, 2024
2 parents 2c8f34e + c646bf7 commit d464f36
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions piecrust-uplink/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

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

## [0.15.0] - 2024-07-03

### Fixed
Expand Down Expand Up @@ -188,6 +192,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- First `piecrust-uplink` release

<!-- ISSUES -->
[#375]: https://github.com/dusk-network/piecrust/issues/375
[#365]: https://github.com/dusk-network/piecrust/issues/365
[#357]: https://github.com/dusk-network/piecrust/issues/357
[#353]: https://github.com/dusk-network/piecrust/issues/353
Expand Down
6 changes: 6 additions & 0 deletions piecrust-uplink/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ impl AsMut<[u8]> for ContractId {
}
}

impl PartialEq<[u8; CONTRACT_ID_BYTES]> for ContractId {
fn eq(&self, other: &[u8; CONTRACT_ID_BYTES]) -> bool {
self.0.eq(other)
}
}

impl core::fmt::Debug for ContractId {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
core::fmt::Display::fmt(self, f)
Expand Down

0 comments on commit d464f36

Please sign in to comment.