We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
AsEnvMut::set_env
1 parent c0fe76c commit b7105bdCopy full SHA for b7105bd
1 file changed
crates/evm/core/src/env.rs
@@ -48,6 +48,17 @@ impl EnvMut<'_> {
48
tx: self.tx.to_owned(),
49
}
50
51
+
52
+ /// Writes an owned [`Env`] back into the context.
53
+ ///
54
+ /// Counterpart to [`to_owned`](Self::to_owned): completes the read/write pair so callers
55
+ /// that receive an updated [`Env`] by value (e.g. after a fork switch or snapshot revert)
56
+ /// can apply it without manually assigning each field.
57
+ pub fn set_env(&mut self, env: Env) {
58
+ *self.block = env.evm_env.block_env;
59
+ *self.cfg = env.evm_env.cfg_env;
60
+ *self.tx = env.tx;
61
+ }
62
63
64
pub trait AsEnvMut {
0 commit comments