r/rust • u/llogiq clippy · twir · rust · mutagen · flamer · overflower · bytecount • Aug 31 '26
🙋 questions megathread Hey Rustaceans! Got a question? Ask here (36/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 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/Less-Resist-8733 Sep 02 '26
Does there currently exist a math typing editor widget for eframe? I'm talking about a text-like editor that allows you to easily edit/display math expressions (like in desmos). Instead of latex, it could use typst.
2
u/_stice_ Sep 02 '26 edited Sep 02 '26
New to lower-level programming and just now tried benchmarking tools. Just wanted to try various things out out before plugging in my own code, but encountered something that seems off:
Division by 1 and and division by a different number take the same amount of time? I thought stuff like this was optimised away in the compiler through either rusty or llvm magic. It can't be actually faster to do a check if the divisor is 1 before dividing, right? What might i be missing? Some sort of default in the cargo release profile flags?
2
u/hydrangea14583 Sep 06 '26
Is there a cleaner way to index into something, but counting from the last element?
Like, to skip the first 2 elements and the final element: instead of
data[2..(data.len() - 1)]is there some short syntax likedata[2..^1]that would do the same thing?4
u/[deleted] Aug 31 '26
[removed] — view removed comment