Skip to content

Commit 6f18889

Browse files
committed
feat: impl traits for envs
1 parent 3dba391 commit 6f18889

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/fill/traits.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ pub trait Tx: Send + Sync {
2727
}
2828
}
2929

30+
impl Tx for TxEnv {
31+
fn fill_tx_env(&self, tx_env: &mut TxEnv) {
32+
*tx_env = self.clone();
33+
}
34+
}
35+
3036
impl Tx for Arc<dyn Tx> {
3137
fn fill_tx_env(&self, tx_env: &mut TxEnv) {
3238
self.as_ref().fill_tx_env(tx_env);
@@ -84,6 +90,12 @@ where
8490
}
8591
}
8692

93+
impl Block for BlockEnv {
94+
fn fill_block_env(&self, block_env: &mut BlockEnv) {
95+
*block_env = self.clone();
96+
}
97+
}
98+
8799
impl Block for Arc<dyn Block> {
88100
fn fill_block_env(&self, block_env: &mut BlockEnv) {
89101
self.as_ref().fill_block_env(block_env);
@@ -132,6 +144,12 @@ impl Cfg for Arc<dyn Cfg> {
132144
}
133145
}
134146

147+
impl Cfg for CfgEnv {
148+
fn fill_cfg_env(&self, cfg_env: &mut CfgEnv) {
149+
*cfg_env = self.clone();
150+
}
151+
}
152+
135153
impl Cfg for Box<dyn Cfg> {
136154
fn fill_cfg_env(&self, cfg_env: &mut CfgEnv) {
137155
self.as_ref().fill_cfg_env(cfg_env);

0 commit comments

Comments
 (0)