this post was submitted on 26 Sep 2024
42 points (100.0% liked)

Rust

5974 readers
134 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS
top 2 comments
sorted by: hot top controversial new old
[โ€“] 0x01@lemmy.ml 4 points 1 month ago

The real example of a health check trait really brings this issue to life, it's linked within op's article as well

Is this a reasonable summary?

Say you want a trait where a method returns a task that you would like to sometimes run within your own thread and sometimes move it to a separate thread to be executed, that means the Send constraint isn't necessary to add to your trait but it would be nice to add that constraint within another method's parameter definition so that it can accept structs that implement the trait and further constrain that implementation to be Send'able. That's now possible with this new rust language feature, though it was previously possible through a crate, now it's no longer needed.

Is anyone actually going to go and check what they asked for? I feel like I understood what they asked but still don't know where to start if I were to try.