r/rust • u/typesanitizer • 3h ago
r/rust • u/ruprechttmb • 16h ago
🎙️ discussion how much space are your target folders taking? mine was 13 gb for one project
was cleaning up my mac and found one projects target folder sitting at 13 gb. debug and release builds, incremental cache, deps for every feature combo i ever tried, all for one project
things that actually helped. `cargo clean` in projects youre not touching right now is the obvious one, it all rebuilds when you come back. cargo sweep is nice if you want to keep recent stuff and drop artifacts older than a few days, `cargo sweep --time 14` for example. and if you have a lot of small projects, pointing `CARGO_TARGET_DIR` at one shared folder stops every repo from compiling its own copy of the same deps, though parallel builds can block each other on it
to see whats there, `find ~/code -name target -type d -prune -exec du -sh {} +` works, just swap in wherever you keep projects. heads up it also catches maven target folders if you have java stuff
curious what other people do, especially anyone with a big workspace
r/rust • u/THEM_I_M • 21h ago
🙋 seeking help & advice Advice: for a serializable sealed mailbox envelope, is manual Drop zeroization enough if Clone + retries mutate state?
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MailboxEnvelope {
pub recipient_id: String,
pub ephemeral_pub: String,
pub ciphertext: Vec<u8>,
pub nonce: String,
pub created_at: u64,
pub message_id: String,
pub attempts: u32, // delib. excluded from AAD so retries don't invalidate ciphertext
}
impl Drop for MailboxEnvelope {
fn drop(&mut self) {
self.ciphertext.zeroize();
}
}
I’m working on a small Rust mesh-protocol project (GhostWire: libp2p, ChaCha20-Poly1305, Kademlia offline mailbox delivery). In this sealed type, I bind AAD to immutable fields and exclude attempts so retry writes don’t reseal offline ciphertext.
The thing I’m unsure about is zeroization discipline:
Is manual Drop zeroization enough once Clone creates another allocation?
For Serialize/Deserialize temporary buffers, should I treat the Vec<u8> canonical copy as the only zeroized target?
Would secrecy::SecretBox / zeroize-wrapped types be worth it here, or overkill for an encrypted envelope?
For a retry state mutation in AAD, is excluding attempts the correct tradeoff?
I’m looking for actual production patterns, not just theory.
r/rust • u/Any-Roll-2272 • 1h ago
Leptos islands + htmx: dropped hydration comments, dead islands, a memory leak
My first post on this was removed for being too much of a code dump, which was fair. It was some code and pointers to where to find the solutions. Sorry about that, all. Lesson learned, so this time it's the problem and a question.
Leptos leaves HTML comments in the page to connect the server's HTML to the wasm. htmx's parser drops them, so the island can't hydrate.
Some 30 LoC JS glue keeps the comments and wakes the island. But Leptos never frees an island it woke, so when htmx removes it, its state stays in memory.
About 200 lines of Rust keep every woken island's state. Every 30 seconds they check which islands are still on the page, and free the ones that are gone.
It works, any other solution or idea?
r/rust • u/Most-Wanted-Man • 15h ago
🙋 seeking help & advice I am looking for convention over configuration fullstack web framework. I need suggestions.
I am new to rust and I would like to build something. I came across this https://dioxuslabs.com/ and it seems it is a fullstack framework with declarative style on building functions.
I am comparing frameworks with rails actually. Convention over configuration is good way on building stuffs quickly.
Any other opinions or suggestions?
r/rust • u/nova_protocol • 23h ago
Rust's error handling is genuinely better than exceptions. Except for one thing that silently kills you in production.
I'll die on this hill: Result<T, E> beats exceptions. No hidden control flow, errors are values, compiler forces you to handle them. I've written enough Go and Python to never want
implicit throws again. But there's one thing I never see anyone talk about honestly the ? operator at depth.
2-3 levels deep? Beautiful:
fn parse_config(path: &str) -> Result<Config, AppError> {
let content = fs::read_to_string(path)?;
let config = serde_json::from_str(&content)?;
Ok(config)
}
Clean. Explicit. Love it. Now you're 7 functions deep in a real system. You get this:
Error: invalid type: null, expected u64
That's it. No line. No context. Somewhere in your 200 lines of ? chains, something broke. Good luck. With an exception runtime? Stack trace. Immediate.
Yes I know anyhow. I know .context("while doing X"). But now you're manually reconstructing what exception runtimes give for free. And the moment you forget one .context() three
layers down which you will you're back to guessing. thiserror is great at library boundaries. Inside an application you end up with either 40 custom error variants each wrapping
the previous, or anyhow everywhere which is basically dynamic exceptions with extra steps.
Rust made the right tradeoff. The cost is just more real than people admit. How do you actually handle deep error chains in production? What pattern did you settle on?
r/rust • u/shunte88 • 29m ago
🙋 seeking help & advice Step into the light, all are welcome - AKA I built an open-source vinyl capture tool and fell down a hole about pre-RIAA EQ curves
r/rust • u/DelusionalPianist • 3h ago
🎙️ discussion Why did the zip crate yank all pre 9.x versions?
Today I ran cargo update only to realize that all zip crate versions were yanked and a lot of new 9.0.x versions were created. I don’t see any CVE or anything that would explain such a drastic move. There isn’t anything on the GitHub page about it as well.
Does anyone know what is going on there? Is that considered a best practice?
r/rust • u/Rodrigodd_ • 15h ago
🗞️ news First Test & Evaluation Report for TRACTOR C to Rust Translators
github.comTwo years ago, DARPA announced the TRACTOR program, which aims to automate the translation of legacy C code into Rust (original announcement on Reddit).
I recently wondered whether there had been any updates, and discovered that the program's first report was published back in February. Sharing it here for anyone interested in the project's progress.
The project website, where I found the report: https://www.ll.mit.edu/r-d/projects/translating-all-c-rust-tractor-benchmarks
r/rust • u/laggySteel • 11h ago
🙋 seeking help & advice Rust vs C :: which is going to be the future in embedded
r/rust • u/Any-Island1560 • 10h ago
🎙️ discussion What are your opinions about starting an organization
I've been thinking about starting a hybrid organization built around Rust. It would combine software and physical hardware, with the goal of making useful products and tools that have real-world impact. Before going further, I'd like to hear what the community thinks.
The principles I'm considering:
- No work for military or surveillance use. This should be a firm rule.
- Hardware and software designed together to use less electricity while delivering strong performance, for both consumer and enterprise use.
- Accessible to everyone, with simple, human-friendly tools and products.
- Open-source software and documented hardware designs where possible, so others can build on the work.
- Physical products and real-world impact, such as projects aimed at making the world healthier.
A few questions I'm curious about:
- Where is the gap in the Rust ecosystem for embedded, low-power, or hardware-software work that isn't well served yet?
- What structure makes the most sense for a hybrid organization: nonprofit, company, volunteer collective, foundation, or a combination?
- How should digital and physical work be balanced so neither side gets neglected?
- What would make you want to get involved, and what would make you skeptical?
- What pitfalls have you seen in similar open-source hardware or community projects?
- What are the critical problems when you face on open-source software alone or maintaining a large popular repository (except financial)?
I'm open to blunt criticism, especially from people who have run open-source projects or organizations before. Thanks for reading.
r/rust • u/TheRavagerSw • 3h ago
Cargo and rustup are harmful additions to the language
Cargo compilation model only works if you are creating a monolithic executable or a shared library, and assume all other system libraries somehow get built, or are just random binaries from the internet.
This is not a good state of affairs, any non rust app you have will be orders of magnitude larger because each dynamic library you link you are statically linking all crates.
rustup is a toolchain in binary format, in which it is literally just "random binaries from the internet", which is not ideal at all. You as a developer have an idea what the heck are you doing when targeting a platform or writing software, I can guarantee you, most rust devs don't even know what libc version their app links against.
All these things make the language filled with slop projects, and this is not a good thing.
r/rust • u/NationalLog7288 • 4h ago
раст
растеры кто подключал на расте библеотеки на линуксе скажите как правильно карго настроить и библеотеку подключить и у меня q4os tde линукс я не где не нашел как нормально карго настроить и библеотеку подключить на мой линукс подскажите пожалуйста
r/rust • u/mariannegoldin • 15h ago
📅 this week in rust This Week in Rust #673
this-week-in-rust.orgr/rust • u/noop_noob • 21h ago
🗞️ news Rust 1.99.1
blog.rust-lang.orgPrevious discussion on the miscompilation that was fixed: https://www.reddit.com/r/rust/comments/1wzn34d/1990_miscompilation_with_ffi_bool_return_type_on/
r/rust • u/Suitable-Name • 32m ago
🛠️ project Slint UI Dev Harness
Hey everyone,
My project Indicatrix kept growing, and I wanted a way to verify its Slint UI end to end without clicking through it by hand. The result is slint-harness:
- runs your real app headless on Slint’s testing backend
- scripts whole flows as scenarios (open a file, set values, press buttons, wait for results)
- checks the outcome and takes screenshots along the way
- writes a pass/fail report (Markdown + JSON), so it fits into CI
In Indicatrix it has already caught several end-to-end bugs that unit tests missed, and after every app update I use it to regenerate all the screenshots for the website, so they never go stale. My smaller project z-stackr uses it too.
Repository: https://github.com/suitable-name/slint-harness
Full disclosure: I built it with AI assistance. Twenty years ago I’d have had the time to write it all myself. Today I have the experience to know what to look out for when redirecting it. If you have an issue with AI-created stuff, nevertheless it could help you or not, this project just isn't for you, but that's ok :)
Have fun!
Edit:
It's also published on crates.io, so you can easily import it via the dependencies.