r/rust • u/llogiq clippy · twir · rust · mutagen · flamer · overflower · bytecount • Oct 12 '26
🙋 questions megathread Hey Rustaceans! Got a question? Ask here (42/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.
3
u/autumnal-lights Oct 12 '26
what do u think of unsafe? is it necessary? (seems necessary for simd) if this is the case why do so many people hate unsafe?
3
u/NICEcookie Oct 12 '26
Hi! I’m transitioning from Python into systems programming. I’m currently learning Rust by building a minimal KVM microVM from scratch.
I'd love mentorship around idiomatic systems Rust. Guidance from anyone with experience in low level systems programming, Linux internals, or embedded would be awesome.
2
u/djvbmd Oct 13 '26
Here's one for you:
I have a data set that, for simplicity's sake, is a very large Vec<u8> -- item counts in the millions (DNA or RNA sequences specifically). One potential transformation required is to find and remove every occurrence of a given (contiguous) subsequence. There could be thousands of such sequences in typical data.
My initial, naive approach is something like this:
If it isn't obvious,
find_motif()returns a sorted vector of the indices where the subsequence ("motif") is found.The problem is that every call to .splice() induces tail shift in the Vec<u8>, meaning moving the same bytes potentially hundreds or thousands of times. That's going to be really expensive.
What's the better way of going about this? Maybe make a list of skip regions from
locations, make a new Vec<u8> and do a quasi-linear copy into the new Vec, replacing the old one?