News for hackers. Stuff that matters.
Re:Hyper – A fast and correct HTTP implementation for Rust by cschneid on Friday May 12, 2023 @04:36PM (#35922015)
What's the current state of database access? Last I looked a while back Diesel was really cool, but didn't play nice w/ Async.
Re:Hyper – A fast and correct HTTP implementation for Rust by satvikpendem on Friday May 12, 2023 @04:38PM (#35922046)
I use Prisma Client Rust [0], coming from the Node.js world, it works great. Some people like to use sqlx though, I'm not too big into writing SQL for every little thing.

[0] https://github.com/Brendonovich/prisma-client-rust

Re:Hyper – A fast and correct HTTP implementation for Rust by phaer on Friday May 12, 2023 @05:10PM (#35922456)
Haven't used it myself, but https://github.com/SeaQL/sea-orm seems to be popular in some communities and async
Re:Hyper – A fast and correct HTTP implementation for Rust by lwhsiao on Friday May 12, 2023 @05:57PM (#35923009)
SQLx [1] is commonly recommended. It has the nice feature that your queries can be verified at compile time.

[1]: https://github.com/launchbadge/sqlx

Re:Hyper – A fast and correct HTTP implementation for Rust by mattrighetti on Saturday May 13, 2023 @04:24PM (#35932343)
The first time I used SQLx I was completely blown away by this. It’s an incredibly useful feature that I’ve never seen before and now I’m actually spoiled by it!

The only downside is that you have to install sqlx-cli and you have to run a couple of special commands to make your binary compile offline or on CI/CD where you don’t provide that database connection.

Re:Hyper – A fast and correct HTTP implementation for Rust by Spartan-S63 on Friday May 12, 2023 @06:07PM (#35923106)
Diesel now has an official async adapter: https://crates.io/crates/diesel-async
Re:Hyper – A fast and correct HTTP implementation for Rust by telios on Friday May 12, 2023 @07:22PM (#35923755)
I've used diesel async for personal projects, and while it does work seamlessly with diesel at times, there are some rough edges - I ran into an odd issue where the order of imports from the base diesel package and diesel async mattered, and it would compile with one above the other, but not the other way around.
Re:Hyper – A fast and correct HTTP implementation for Rust by davidatbu on Saturday May 13, 2023 @01:20AM (#35925828)
I've also used with diesel async for personal projects, and I have ran into no rough edges at all, fwiw.
Re:Hyper – A fast and correct HTTP implementation for Rust by redman25 on Friday May 12, 2023 @06:26PM (#35923289)
Async is not necessarily as useful for database connections since connection counts will generally be in the 10s and handled with a thread pool. It's pretty low overhead to just use pooling.
Re:Hyper – A fast and correct HTTP implementation for Rust by unshavedyak on Friday May 12, 2023 @06:35PM (#35923392)
Yea but you still want a good async interface if you're already using async, even if it's mocked over an underlying threadpool. Otherwise you have to wrap all your DB clients in your own adhoc async wrappers which feels kinda bad, imo.
Re:Hyper – A fast and correct HTTP implementation for Rust by laurencerowe on Friday May 12, 2023 @07:19PM (#35923738)
It’s frustrating there seems to be no good threaded web server for Rust given how uniquely great Rust is at threading.

You can adapt from async to sync but there is a definite complexity tax with all the pinning plus the runtime cost of the extra pinning.

Async is great for more proxy like use cases though.

Re:Hyper – A fast and correct HTTP implementation for Rust by laurencerowe on Saturday May 13, 2023 @04:52AM (#35926741)
*runtime cost of the extra copying.