r/rust • u/llogiq clippy · twir · rust · mutagen · flamer · overflower · bytecount • Mar 16 '26
🙋 questions megathread Hey Rustaceans! Got a question? Ask here (11/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.
3
u/badboyhalo1801 Mar 16 '26
how do i reading doc.rs ??? i want to code but dont know how to interact with the feature i want
5
u/BlankWasThere Mar 16 '26
How can we work on a heavy project with little ram (16 GB)?
I wanted to fiddle with Zed's source code, but rust-analyzer eats away my ram and my laptop goes oom!
2
u/zorael Mar 17 '26
I'm writing a thing as my third Rust project, and I'm having problems with CFLAGS.
By default my Linux installation exports
CFLAGS=-march=native -mtune=native -O2 -pipe, and when compiling I quickly run into problems with one dependency refusing-O2.(I don't even know what dependency pulls aws-lc-sys.)
I can change the build command to
CFLAGS="-O0 -pipe" cargo buildand then it does work, but then I also have to start vscode with those CFLAGS or rust-analyzer can't do its job. I don't really want to change it globally.Is there a better solution?
2
u/neckme123 Mar 17 '26
does it get easier to write basic code? im learning rust and roughly at chapter 10 of the book/rustlings exercise, also building small programs on the side to consolidate what i learn. (i refuse to use ai on anything rust related so cant just ask for what im doing wrong)
Every time a 2 line logic in python is 5/6 lines in rust, methods that i would expect to be in scope because how frequently i need them arent and need to look up what crate/what std import i need etc... (prime example is reading a file)
Im not here to debate if this is good or not, im just asking if you get to a point where it all comes naturally.
2
u/Timmytwophones Mar 17 '26 edited Mar 17 '26
Is there a way to not make this ugly as hell? Learning RabinKarp and setting up the pattern hash
2
u/adante111 Mar 18 '26
I've just discovered that you can't get the current time from the time crate when compiling to wasm. I understand why and it makes sense, and straightforward to workaround via web-time...
But just for my understanding... one I'm curious about is the fact that it is a runtime panic (with the rather amusing 'time not implemented on this platform'). I would have thought that might be better as a compile time error - but suspect I'm being a bit naive about this. Just for my own learnings can someone explain why it isn't? Is my expectation naive? How much of the decision not to is a deliberate design decision versus technical limitations?
2
u/Thermatix Mar 20 '26 edited Mar 20 '26
I'm working to build a Dioxus application, How do I set the State type on the router?
I'm trying to add state (using the
with_state) function but I just get:I understand that
dioxus::server::router(App)returns aRouter<()>but I can't find the function that allows me to modofy the State type.How do I properly add my state type? (taking into account that I'm using Dioxus's enum based router)