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

style: Rename spawn<T> to spawn<F> #5993

Merged

Conversation

adamchalmers
Copy link
Contributor

@adamchalmers adamchalmers commented Sep 9, 2023

Rename tokio::task::spawn to tokio::task::spawn, to match spawn_local.

Motivation

I was flipping back and forth between the docs page for spawn and spawn_local to understand the differences in which constraints they impose upon their future. I thought it was weird that one is generic over T and one over F.

Solution

I think they should match, and F is more descriptive (F for Future).

tokio::task::spawn_local is generic over F but tokio::task::spawn is generic over T. I think they should match, and F is more descriptive (F for Future).
@adamchalmers
Copy link
Contributor Author

adamchalmers commented Sep 9, 2023

@Noah-Kennedy hi there, really vital PR here :P

Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

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

Thank you.

@Darksonn Darksonn added A-tokio Area: The main tokio crate M-task Module: tokio/task labels Sep 10, 2023
@Darksonn Darksonn merged commit 737dff4 into tokio-rs:master Sep 10, 2023
@adamchalmers adamchalmers deleted the achalmers/change-generic-name branch September 10, 2023 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-task Module: tokio/task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants