← Home ← Back to /g/

Thread 106866031

11 posts 2 images /g/
Anonymous No.106866031 [Report] >>106866091 >>106866396
- Tokio
- thiserror
- serde

These are the only 3 crates you need.

tokio and serde provide an excellent ecosystem.

If you're a GUI fag, I'm afraid we're not there yet. Just stick with Bevy or Dioxus for now.

God bless.
Anonymous No.106866043 [Report] >>106866071
Use case?
Anonymous No.106866071 [Report]
>>106866043
getting shit done.
Anonymous No.106866091 [Report] >>106866201
>>106866031 (OP)
Does most Software even need Tokio?
Isn't Rust made to make threading easy?
Anonymous No.106866201 [Report] >>106866216
>>106866091
multithreading is easy. Async is not. It's why you need a runtime. Any production ready application needs to be able to manage asynchronous tasks.

Async isn't just about multi threading. It's about concurrency too. It manages everything for you.
Anonymous No.106866216 [Report] >>106866304
>>106866201
I just wonder ow many applications need that. When you make a web server or a database that might have thousands of concurrent tasks open, sure. But most Rust tools are random CLI shit that processes some files in parallel and that's what threading does well.
Anonymous No.106866304 [Report] >>106866322
>>106866216
Even a CLI needs to manage resources asynchronously. You’ll want at least two tasks running, one to handle terminal output and another to perform the actual work. If both run on the same thread, the app will feel sluggish and unresponsive.
Anonymous No.106866322 [Report] >>106866389
>>106866304
Indeed. So spawn a thread. It's in the standard library.
https://doc.rust-lang.org/std/thread/fn.spawn.html

Or spawn a scoped one if you want to be able to borrow data in it.
Anonymous No.106866389 [Report]
>>106866322
If it's a simple CLI yes. If not, you're just gonna have a bad time. 99.9% of production ready apps handle persistence too. This is when async shines, you log your process in the background, update the terminal and perform your work. spawning threads may not be the most efficient way to handle this. You're effectively making a threadpool and managing it by hand. Why do this when async runtimes will it for you for free using readable syntax with minimal threads.
Anonymous No.106866396 [Report] >>106867391
>>106866031 (OP)
>using rust
Have you filled out an environmental impact assessment for your program and ensured you are complying with all portions of the Title VII of the Civil Rights Act when accepting and making contributions?
That language checks your political alignment at compile time.
Anonymous No.106867391 [Report]
>>106866396
rust is good for you. Even if you don't like it learn it. It will make you a better programmer