blog-comments
async-trait
blog-comments | async-trait | |
---|---|---|
1 | 7 | |
0 | 1,697 | |
- | - | |
0.0 | 8.2 | |
almost 6 years ago | 16 days ago | |
Rust | ||
- | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
blog-comments
-
Why asynchronous Rust doesn't work
This was a great article, very easy to understand without leaving out the fundamental pieces (the saga that is async implementation difficulty). I think I can even boil this situation down to Rust having it's Monad moment.
It's in this (HN) comment thread and a bunch of informed comments on the original article:
https://github.com/eeeeeta/blog-comments/issues/10#issuecomm...
https://github.com/eeeeeta/blog-comments/issues/10#issuecomm...
https://github.com/eeeeeta/blog-comments/issues/10#issuecomm...
The comments are correct in my view -- Rust can't/shouldn't do what Haskell did, which was to create use a general purpose abstraction that is essentially able to carry "the world" (as state) along with easy-to-trade chained functions on that state (whenever it gets realized). Haskell might have solved the problem, but it has paid a large price in language difficulty (perceived or actual) because of it, not mentioning the structural limitations of what Rust can do and it's constraints. The trade-off just isn't worth it for the kind of language Rust aims to be.
Realistically, I think this issue is big but not enough to write off rust for me personally (as the author seems to have) -- I'd just do the move + Arc shenanigans because if you've been building java applications with IoC and/or other patterns that generally require global-ish singletons (given example was a DB being used by a server), this isn't the worst complexity trade-off you've had to make, though the Rust compiler is a lot more ambitious, and Rust has a cleaner, better, more concise type system as far as I'm concerned.
I think another thing I've gained from this article is another nice little case where Haskell (if you've taken the time to grok it sufficiently, which can be a long time) offers a bit of a nicer general solution than Rust, assuming you were in a world where those two were actually even substitutes. In the much more likely world where you might compare Rust and Go2, this might be a win for Go2, but the rest of the language features would put rust on top for me.
async-trait
-
Introduction to Rust generics [1/2]: Traits
As of today, async functions in traits are not natively supported by Rust. Fortunately, David Tolnay got our back covered (one more time): we can use the async-trait crate.
- How to assign async fn to type?
-
Understanding lifetimes for real?
You might want to check out https://github.com/dtolnay/async-trait to be able to declare async functions in a trait.
-
David Tolnay - thank you
Also async-trait (GitHub), dtolnay has done some great work!
-
What are your favorite tricks or hacks in rust?
Does async-trait count as a trick or hack? It's not my hack, but it's a workaround/hack that I use every single day.
-
Why asynchronous Rust doesn't work
This macro goes a very long way toward solving the problem: https://github.com/dtolnay/async-trait
-
Question about traits, associated types, Future, Pin, and Send...
I'm still learning async to I cannot answer all the questions. First of all, I use this -> https://github.com/dtolnay/async-trait to take care of the async-inside-traits mess.
What are some alternatives?
monadless - Syntactic sugar for monad composition in Scala
ureq - A simple, safe HTTP client
reqwest - An easy and powerful Rust HTTP Client
serde-yaml - Strongly typed YAML library for Rust
rust-quiz - Medium to hard Rust questions with explanations
toml-rs - A TOML encoding/decoding library for Rust
cargo-llvm-lines - Count lines of LLVM IR per generic function
rust-script - Run Rust files and expressions as scripts without any setup or compilation step.
rupy - HTTP App. Server and JSON DB - Shared Parallel (Atomic) & Distributed
hyper - An HTTP library for Rust
db-dump - Library for scripting analyses against crates.io's database dumps