Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add launch_with_fn #8694

Merged
merged 1 commit into from
Jun 10, 2024
Merged

feat: add launch_with_fn #8694

merged 1 commit into from
Jun 10, 2024

Conversation

mattsse
Copy link
Collaborator

@mattsse mattsse commented Jun 8, 2024

provides a way to use closure launchers and implement LaunchNode for closures

@mattsse mattsse requested review from Rjected and onbjerg as code owners June 8, 2024 09:42
@mattsse mattsse added C-enhancement New feature or request A-sdk Related to reth's use as a library labels Jun 8, 2024
@@ -220,6 +220,14 @@ impl<T: FullNodeTypes, CB: NodeComponentsBuilder<T>> NodeBuilderWithComponents<T
launcher.launch_node(self).await
}

/// Launches the node with the given closure.
pub fn launch_with_fn<L, R>(self, launcher: L) -> R
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the difference between this and launch_with(closure) given closures now impl LaunchNode?

Copy link
Collaborator Author

@mattsse mattsse Jun 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this supports arbitrary logic and supports launch functions as closures and helps with type hints, otherwise the user would need to provide type hints explicitly on launch_node

@mattsse mattsse added this pull request to the merge queue Jun 10, 2024
Merged via the queue into main with commit 53f4eca Jun 10, 2024
30 checks passed
@mattsse mattsse deleted the matt/add-launch-with-fn branch June 10, 2024 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sdk Related to reth's use as a library C-enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants