@@ -77,13 +77,31 @@ pub struct BundleProcessor<B, R> {
77
77
/// The bundle to process.
78
78
pub bundle : B ,
79
79
/// The response for the processed bundle.
80
- pub response : R ,
80
+ response : R ,
81
81
}
82
82
83
- impl < B , R > BundleProcessor < B , R > {
83
+ impl < B , R > BundleProcessor < B , R >
84
+ where
85
+ R : Default ,
86
+ {
84
87
/// Create a new bundle simulator with the given bundle and response.
85
- pub const fn new ( bundle : B , response : R ) -> Self {
86
- Self { bundle, response }
88
+ pub fn new ( bundle : B ) -> Self {
89
+ Self { bundle, response : R :: default ( ) }
90
+ }
91
+
92
+ /// Clear the driver, resetting the response. This resets the driver,
93
+ /// allowing for resimulation of the same bundle.
94
+ pub fn clear ( & mut self ) -> R {
95
+ std:: mem:: take ( & mut self . response )
96
+ }
97
+ }
98
+
99
+ impl < B , R > From < B > for BundleProcessor < B , R >
100
+ where
101
+ R : Default ,
102
+ {
103
+ fn from ( bundle : B ) -> Self {
104
+ Self :: new ( bundle)
87
105
}
88
106
}
89
107
@@ -129,13 +147,7 @@ impl<B, R> BundleProcessor<B, R> {
129
147
impl BundleProcessor < EthCallBundle , EthCallBundleResponse > {
130
148
/// Create a new bundle simulator with the given bundle.
131
149
pub fn new_call ( bundle : EthCallBundle ) -> Self {
132
- Self :: new ( bundle, EthCallBundleResponse :: default ( ) )
133
- }
134
-
135
- /// Clear the driver, resetting the response. This resets the driver,
136
- /// allowing for resimulation of the same bundle.
137
- pub fn clear ( & mut self ) {
138
- std:: mem:: take ( & mut self . response ) ;
150
+ Self :: new ( bundle)
139
151
}
140
152
141
153
/// Process a bundle transaction and accumulate the results into a [EthCallBundleTransactionResult].
0 commit comments