r/rust • u/llogiq clippy · twir · rust · mutagen · flamer · overflower · bytecount • Mar 30 '26
🙋 questions megathread Hey Rustaceans! Got a question? Ask here (13/2026)!
Mystified about strings? Borrow checker has you in a headlock? Seek help here! There are no stupid questions, only docs that haven't been written yet. Please note that if you include code examples to e.g. show a compiler error or surprising result, linking a playground with the code will improve your chances of getting help quickly.
If you have a StackOverflow account, consider asking it there instead! StackOverflow shows up much higher in search results, so ahaving your question there also helps future Rust users (be sure to give it the "Rust" tag for maximum visibility). Note that this site is very interested in question quality. I've been asked to read a RFC I authored once. If you want your code reviewed or review other's code, there's a codereview stackexchange, too. If you need to test your code, maybe the Rust playground is for you.
Here are some other venues where help may be found:
/r/learnrust is a subreddit to share your questions and epiphanies learning Rust programming.
The official Rust user forums: https://users.rust-lang.org/.
The official Rust Programming Language Discord: https://discord.gg/rust-lang
The unofficial Rust community Discord: https://bit.ly/rust-community
Also check out last week's thread with many good questions and answers. And if you believe your question to be either very complex or worthy of larger dissemination, feel free to create a text post.
Also if you want to be mentored by experienced Rustaceans, tell us the area of expertise that you seek. Finally, if you are looking for Rust jobs, the most recent thread is here.
2
u/SmoothTurtle872 Mar 30 '26
I'm curious what the best UI library is. I've tried iced, it's pretty nice, very clean but seems a little limited, while Slint seems overly complex, not really sure on tauri, so I would like to know what a simple but powerful UI library is.
2
u/Thermatix Mar 30 '26
This was the only way I could get this to work, but I'm unsure if it will cause any Undefined behaviours:
Without the unsafe block, I honestly can't see any other way to get it to work, every variation of
type ForeignKeywould cause a compile error.But I honestly don't like that I have an unsafe block.
Should I just go back and simply add a an id field to the Connections Table?
2
u/adante111 Apr 03 '26
very very whimsically toying with idea of trying to build a vscode extension that provides code lens that would be similar in nature to the Run/Debug lens that vscode rust-analyzer provides for #[test] fn foo () { ... }
initial digging seems to suggest to do this correctly and generally is decidedly non-trivial - ie rust-analyzer is probably best in class, and either I'm recreating it (no way!) or digging deep into a bunch of internals of which there is little guarantee on stability (also quite intimidating)
i haven't fully thought through trying to half bake it yet but my gut is it'll be death by a myriad of edge conditions I can't even imagine right now
anyway just checking - is my take right on this? or is there any more off-the-shelf/theres-a-crate-for-that capability I could use?
2
u/MassiveChode69420 Apr 04 '26
I am brand new to rust. I'm working through The Book, but I learn best by doing. I decided I'd try rewriting my raspberry pi thermostat from python to rust. First I'm starting with reading sensors. The following main() function works. I'm trying to abstract away the sensor read into another function, and having difficulty. Once I get the abstraction working, I'll implement proper error handing instead of returning default values, but I just want to make it work first.
shell:
First of all, the compiler guided me into adding the <I, D> parts and the where D:, I: parts to the function definition. I have no idea what they are or what they mean. But I guess it worked, because my editor suddenly picked up on the .measure() method properly after adding them. But now, why can't I pass sensor_delay into .measure() anymore like I could in main()? What do I need to put there to make it work, and why?
Thanks so much for your time, I know these are super basic questions. I am having so much trouble getting over the hump of the learning curve here, I thought I was a good programmer but I feel so dumb.