chore: derive default for enums
This commit is contained in:
parent
c2d7b8321f
commit
27761d7acc
|
@ -531,9 +531,10 @@ impl<'de> Deserialize<'de> for BlockId {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A block Number (or tag - "latest", "earliest", "pending")
|
/// A block Number (or tag - "latest", "earliest", "pending")
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
|
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
|
||||||
pub enum BlockNumber {
|
pub enum BlockNumber {
|
||||||
/// Latest block
|
/// Latest block
|
||||||
|
#[default]
|
||||||
Latest,
|
Latest,
|
||||||
/// Finalized block accepted as canonical
|
/// Finalized block accepted as canonical
|
||||||
Finalized,
|
Finalized,
|
||||||
|
@ -648,12 +649,6 @@ impl fmt::Display for BlockNumber {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for BlockNumber {
|
|
||||||
fn default() -> Self {
|
|
||||||
BlockNumber::Latest
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
#[cfg(not(feature = "celo"))]
|
#[cfg(not(feature = "celo"))]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
|
@ -112,7 +112,7 @@ pub struct Trace {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Response
|
/// Response
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
|
#[derive(Debug, Default, Clone, PartialEq, Eq, Deserialize, Serialize)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum Res {
|
pub enum Res {
|
||||||
/// Call
|
/// Call
|
||||||
|
@ -120,15 +120,10 @@ pub enum Res {
|
||||||
/// Create
|
/// Create
|
||||||
Create(CreateResult),
|
Create(CreateResult),
|
||||||
/// None
|
/// None
|
||||||
|
#[default]
|
||||||
None,
|
None,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Res {
|
|
||||||
fn default() -> Res {
|
|
||||||
Res::None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Action
|
/// Action
|
||||||
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
|
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
|
||||||
#[serde(untagged, rename_all = "lowercase")]
|
#[serde(untagged, rename_all = "lowercase")]
|
||||||
|
@ -198,9 +193,10 @@ pub struct Call {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Call type.
|
/// Call type.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
|
#[derive(Debug, Default, Clone, PartialEq, Eq, Deserialize, Serialize)]
|
||||||
pub enum CallType {
|
pub enum CallType {
|
||||||
/// None
|
/// None
|
||||||
|
#[default]
|
||||||
#[serde(rename = "none")]
|
#[serde(rename = "none")]
|
||||||
None,
|
None,
|
||||||
/// Call
|
/// Call
|
||||||
|
@ -217,12 +213,6 @@ pub enum CallType {
|
||||||
StaticCall,
|
StaticCall,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for CallType {
|
|
||||||
fn default() -> CallType {
|
|
||||||
CallType::None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create response
|
/// Create response
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Default, Deserialize, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Eq, Default, Deserialize, Serialize)]
|
||||||
pub struct Create {
|
pub struct Create {
|
||||||
|
|
Loading…
Reference in New Issue