Skip to content

Commit

Permalink
Add Hash trait to Selector struct (#2149)
Browse files Browse the repository at this point in the history
* Add Hash trait to Selector struct

* Update changelog

* Make Hash derive conditional
  • Loading branch information
0xLucca authored Mar 11, 2024
1 parent 3cc52ff commit cd9927a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
- Add Hash trait to Selector struct

## Version 5.0.0-rc.3

Expand Down
6 changes: 5 additions & 1 deletion crates/metadata/src/specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ use serde::{
Serialize,
};
#[cfg(feature = "std")]
use std::collections::BTreeMap;
use std::{
collections::BTreeMap,
hash::Hash,
};

/// Describes a contract.
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
Expand Down Expand Up @@ -1091,6 +1094,7 @@ where
}

/// The 4 byte selector to identify constructors and messages
#[cfg_attr(feature = "std", derive(Hash))]
#[derive(Debug, Default, PartialEq, Eq, derive_more::From, JsonSchema)]
pub struct Selector(#[schemars(with = "String")] [u8; 4]);

Expand Down

0 comments on commit cd9927a

Please sign in to comment.