32
submitted 14 hours ago by u_1f914@lemmy.world to c/rust@programming.dev
top 1 comments
sorted by: hot top controversial new old
[-] 0x01@lemmy.ml 2 points 12 hours 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.

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

Rust

5803 readers
116 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