|
So the beta is out. I've been keeping my eye on Rust for a while and downloaded it. It seems pretty cool so far!
|
# ¿ Apr 14, 2015 12:33 |
|
|
# ¿ Apr 28, 2024 08:30 |
|
space kobold posted:I've got one dependency that only compiles on the 1.1 nightly, and another dependency that only compiles on the 1.0 beta. Welp. Obvious solution is to compile half your program as a cli executable and call it from the other half
|
# ¿ May 7, 2015 22:12 |
|
gonadic io posted:Quick pick a top library from another language and then write it in Rust! Parsec, lens, an xml parser or something. This maybe isn't a bad idea if you want 15 minutes of programmer fame.
|
# ¿ Jun 15, 2015 00:23 |
|
drainpipe posted:I'm starting to learn Rust, and I have a question about using async with threads. I'm writing a program that has multiple threads, each making different http requests. I'm using the reqwest crate for this, which uses async functions. If I try to spawn a thread, I'd need something like an async closure, which is apparently still unstable. Should I just turn the threads to async tasks? There's no reason why I couldn't, but I just wanted to touch on a greater variety of stuff in Rust. what do you mean? I'm spawning threads inside async functions right now in stable rust. is what you want to do fundamentally different than this? https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=92cb9e316200bbafa59fd23f1b09a876 fart simpson fucked around with this message at 02:29 on Feb 24, 2020 |
# ¿ Feb 24, 2020 02:16 |
|
Look at the example I just linked. Does that not work? e: ok, I think I get it
|
# ¿ Feb 24, 2020 02:30 |
|
drainpipe posted:It could very well be that spawning threads to do async things is not a correct thing to do since the whole point of async is to do concurrency in one thread. But it's just weird then that I can't make http requests (at least with the reqwest crate) on different threads without using an unstable feature. I don't understand why you want to do this in the first place, but you could probably use this if you really want to: https://docs.rs/reqwest/0.10.2/reqwest/blocking/index.html
|
# ¿ Feb 24, 2020 02:44 |
|
drainpipe posted:Ah thanks! There's really no reason I want to do threads over async tasks, and I'm happy to do it either way. I'm just getting a feel for the land right now, and was curious about how various things fit together. Well, if you have some async code and you want to fit it into threads the way you're doing, I think you could wrap your async functions in code:
|
# ¿ Feb 24, 2020 03:19 |
|
street doc posted:I just want to use actix and Postgres for a simple ‘hello world’ example. But it feels like a rabbit hole of complexity. Arctic using tokio? And futures? What asynchronous crate should I be using, in addition to actix? i made a simple website using actix web and postgres last year. it wasn’t that complicated imho
|
# ¿ Mar 12, 2021 02:33 |
|
street doc posted:What dependency did you use for Postgres? Diesel? i used something called r2d2_postgres. dont remember much about it tbh
|
# ¿ Mar 13, 2021 16:14 |
|
looking at it again and it looks like mostly what i did was stored procs in postgres and wrote a macro in rust to help build queries with the postgres tokio wrapper. r2d2 is just a connection pool thingcode:
fart simpson fucked around with this message at 16:29 on Mar 13, 2021 |
# ¿ Mar 13, 2021 16:20 |
|
Ralith posted:You could make the error handling a lot more concise using the ? operator and maybe a From impl or two, and that macro probably doesn't need to be a macro at all, and if you're using tokio postgres stuff you can probably just await it directly. yeah probably. although if i ever decide to touch this again ill probably switch to that sqlx thing people were just talking about. i remember there being a reason i made it a macro, like i tried it another way and it didn’t work. don’t remember why now
|
# ¿ Mar 14, 2021 10:19 |
|
Mata posted:Thanks for the tips, I think into boxed slice is what feels best for me: solution: use bigger arrays and just pad the end with zeroes
|
# ¿ May 20, 2022 06:33 |
|
Subjunctive posted:Does anyone know of a Rust training consultancy they’d recommend? I’m thinking of adopting more Rust where I work and as part of that I’d like to look into some structured training options. nope sorry i dont know anything about this
|
# ¿ Aug 25, 2022 06:35 |
|
|
# ¿ Apr 28, 2024 08:30 |
|
i was being sincere
|
# ¿ Aug 26, 2022 03:11 |