feat(ethers-core/Chain): implement Default trait (#976)

This commit is contained in:
Meet Mangukiya 2022-03-01 02:28:04 +05:30 committed by GitHub
parent e0f5fe5325
commit 4fd9c7800e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 1 deletions

View File

@ -2,7 +2,7 @@ use serde::Deserialize;
use thiserror::Error; use thiserror::Error;
use core::convert::TryFrom; use core::convert::TryFrom;
use std::{fmt, str::FromStr}; use std::{default, fmt, str::FromStr};
use crate::types::U256; use crate::types::U256;
@ -177,3 +177,14 @@ impl Chain {
) )
} }
} }
impl default::Default for Chain {
fn default() -> Self {
Chain::Mainnet
}
}
#[test]
fn test_default_chain() {
assert_eq!(Chain::default(), Chain::Mainnet);
}