@@ -145,6 +145,16 @@ impl<T> LaunchContextWith<T> {
145145 attachment : Attached :: new ( self . attachment , attachment) ,
146146 }
147147 }
148+
149+ /// Consumes the type and calls a function with a reference to the context.
150+ // Returns the context again
151+ pub fn inspect < F > ( self , f : F ) -> Self
152+ where
153+ F : FnOnce ( & Self ) ,
154+ {
155+ f ( & self ) ;
156+ self
157+ }
148158}
149159
150160impl < L , R > LaunchContextWith < Attached < L , R > > {
@@ -338,6 +348,12 @@ where
338348 )
339349 }
340350
351+ /// Convenience function to [Self::init_genesis]
352+ pub fn with_genesis ( self ) -> Result < Self , InitDatabaseError > {
353+ init_genesis ( self . provider_factory ( ) . clone ( ) ) ?;
354+ Ok ( self )
355+ }
356+
341357 /// Write the genesis block and state if it has not already been written
342358 pub fn init_genesis ( & self ) -> Result < B256 , InitDatabaseError > {
343359 init_genesis ( self . provider_factory ( ) . clone ( ) )
@@ -352,6 +368,12 @@ where
352368 self . node_config ( ) . max_block ( client, self . provider_factory ( ) . clone ( ) ) . await
353369 }
354370
371+ /// Convenience function to [Self::start_prometheus_endpoint]
372+ pub async fn with_prometheus ( self ) -> eyre:: Result < Self > {
373+ self . start_prometheus_endpoint ( ) . await ?;
374+ Ok ( self )
375+ }
376+
355377 /// Starts the prometheus endpoint.
356378 pub async fn start_prometheus_endpoint ( & self ) -> eyre:: Result < ( ) > {
357379 let prometheus_handle = self . node_config ( ) . install_prometheus_recorder ( ) ?;
0 commit comments