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: impl Clone for task_local where T: Clone #6433

Merged
merged 1 commit into from
Apr 10, 2024

Conversation

fenollp
Copy link
Contributor

@fenollp fenollp commented Mar 26, 2024

Motivation

From the docs it is clear one can LocalKey::get() a copy of T.
I hard a hard time finding how to get a clone of T (my T is not Copy, it's a struct of Arcs).

Solution

This PR adds a clone method alongside the existing get method.

@mox692 mox692 added A-tokio Area: The main tokio crate M-task Module: tokio/task labels Mar 27, 2024
@Darksonn
Copy link
Contributor

Maybe we should just expand the Copy bound on get.

@Darksonn
Copy link
Contributor

Darksonn commented Apr 6, 2024

Any updates on this?

Signed-off-by: Pierre Fenoll <pierrefenoll@gmail.com>
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, and sorry again for not being clear in my suggestions.

@Darksonn Darksonn merged commit ccee1d4 into tokio-rs:master Apr 10, 2024
75 checks passed
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.

3 participants