Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

feat(chain): enum values + TryFrom<u64> #782

Merged
merged 3 commits into from
Jan 11, 2022
Merged

Conversation

tarrencev
Copy link
Contributor

@tarrencev tarrencev commented Jan 10, 2022

Upstream changes to support feedback at foundry-rs/foundry#412

cc @mattsse

ethers-core/src/types/chain.rs Show resolved Hide resolved
ethers-core/src/types/chain.rs Outdated Show resolved Hide resolved
impl TryFrom<u64> for Chain {
type Error = ();

fn try_from(chainid: u64) -> Result<Chain, Self::Error> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could use a crate like https://crates.io/crates/num_enum to avoid duplicating the mapping here

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it's fine as-is, if we see the maintenance of this becoming a problem we can consider

@gakonst gakonst merged commit 092bd96 into gakonst:master Jan 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants