Skip to content

Commit

Permalink
Add blanket impl for TxType
Browse files Browse the repository at this point in the history
  • Loading branch information
emhane committed Nov 10, 2024
1 parent 8e0da8f commit 68108f8
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion crates/primitives-traits/src/tx_type.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use core::fmt::{Debug, Display};

use alloy_eips::eip2718::Eip2718Error;
use alloy_primitives::{U64, U8};
use alloy_rlp::{Decodable, Encodable};
use core::fmt::{Debug, Display};

/// Trait representing the behavior of a transaction type.
pub trait TxType:
Expand All @@ -25,3 +26,25 @@ pub trait TxType:
+ 'static
{
}

impl<T> TxType for T where
T: Into<u8>
+ Into<U8>
+ PartialEq
+ Eq
+ PartialEq<u8>
+ TryFrom<u8, Error = Eip2718Error>
+ TryFrom<u64>
+ TryFrom<U64>
+ Debug
+ Display
+ Clone
+ Copy
+ Default
+ Encodable
+ Decodable
+ Send
+ Sync
+ 'static
{
}

0 comments on commit 68108f8

Please sign in to comment.