r/rust • • 13h ago

🎙️ discussion how much space are your target folders taking? mine was 13 gb for one project

6 Upvotes

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 • • 22h ago

🛠️ project `bitflags-lite`: a macro-free, trait-based alternative to `bitflags`

5 Upvotes

Hello r/rust,

I prefer to avoid macros when they can be avoided without major sacrifices, and I ran into this again recently with bitflags. I wanted several simple bit flags, but every bitflags! macro invocation expanded to about 800 lines of code.

So I wrote bitflags-lite: https://crates.io/crates/bitflags-lite, https://docs.rs/bitflags-lite

The design is simple: instead of generating a distinct struct per flag set, it defines a single generic BitFlags<T, U> where: * T is storage type like u8 or u32, * U is a tag that describes which bits are valid, their names, and the default parsing strategy for case sensitivity.

```rust use bitflags_lite::{BitFlags, BitFlagsSpec, NameMatcher};

struct PermissionsTag;

impl BitFlagsSpec<u32> for PermissionsTag { const VALID_BITS_MASK: u32 = (1 << 3) - 1; const FLAG_NAMES: &[&[&str]] = &[&["read"], &["write"], &["exec", "execute"]]; const DEFAULT_NAME_MATCHER: NameMatcher = NameMatcher::AsciiCaseInsensitive; }

type Permissions = BitFlags<u32, PermissionsTag>;

const READ: Permissions = Permissions::try_from_bit(0).unwrap(); const WRITE: Permissions = Permissions::try_from_bit(1).unwrap(); const EXEC: Permissions = Permissions::try_from_bit(2).unwrap(); const RWX: Permissions = Permissions::try_from_bits(0b111).unwrap();

assert_eq!(RWX, (READ | WRITE | EXEC)); assert!(RWX.contains(READ));

let flags = Permissions::from_str("ReaD | 0x18 | wriTE").unwrap(); assert_eq!(flags, (READ | WRITE | Permissions::from_bits_retain(0x18))); assert_eq!(flags.to_string(), "read | write | 0x18"); ```

That's the whole definition. No hidden codegen.

What you give up: * No automatic deduction of names and valid bits. You write VALID_BITS_MASK and FLAG_NAMES by hand and keep them in sync with your constants. * No named multi-bit flags. You can still build a set containing several bits (Permissions::try_from_bits(0b111) above), but there's no way to declare a multi-bit constant inside the spec. Each bit corresponds to exactly one BitFlag with a name and optional aliases.

What you get instead: * The generic BitFlags<T, U> type. * A clearer single-flag (BitFlag) vs. flag-set (BitFlags) distinction. * A single small trait impl per flag set, rather than a fresh copy of the entire API. * Alias names for parsing ("exec" and "execute" for the same bit). * Optional ASCII case-insensitive parsing.

The crate supports no_std and no_alloc, and is const-friendly. Every constructor and combinator on the concrete integer types is const fn, with generic equivalents in BitFlagsExt / BitFlagExt. Optional serde, arbitrary, and bytemuck support via features.

I would love to hear your feedback, and I am happy to answer questions!


r/rust • • 29m ago

🎙️ discussion What agents mean for Rust (and vice versa)

Thumbnail smallcultfollowing.com
• Upvotes

r/rust • • 18h ago

🙋 seeking help & advice Advice: for a serializable sealed mailbox envelope, is manual Drop zeroization enough if Clone + retries mutate state?

0 Upvotes

#[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 • • 11h ago

🙋 seeking help & advice I am looking for convention over configuration fullstack web framework. I need suggestions.

0 Upvotes

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 • • 20h ago

Rust's error handling is genuinely better than exceptions. Except for one thing that silently kills you in production.

0 Upvotes

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 • • 22h ago

I will build website with Rust. Can?

0 Upvotes

Throughout my career I only build websites especially backend stuffs. I want to try Rust. Possible?


r/rust • • 17h ago

I still hate acrobat

Thumbnail uden.dev
36 Upvotes

r/rust • • 22h ago

🛠️ project docmux: a document converter in Rust and WASM, tested against 397 real arXiv papers

0 Upvotes

I've been building docmux, a document converter (LaTeX, Markdown, Typst, DOCX, HTML, MyST) with a Reader → AST → Writer pipeline. Each format is its own crate, so the WASM build only carries what it uses. Playground: https://docmux.pages.dev/playground/ (runs entirely in the browser).

A few things I learned along the way:

  • Real documents find what unit tests don't. I run it against the LaTeX sources of 397 arXiv papers, most of them a random sample, since famous papers tend to have tidy LaTeX. Every failure becomes a small test in the crate that owns it. The last batch found carriage returns from old sources reaching the output, where Typst reads them as line breaks.
  • "sideEffects": false in the npm package let bundlers drop the line that initializes the wasm-bindgen module. Dev builds worked and production builds failed on the first call.
  • Word math is a tree format (OMML), so the emitter builds atoms first, then attaches n-ary bodies and function arguments. I check it by reading the files back with pandoc: 178,132 equations across the corpus.

Code (MIT): https://github.com/aguschirico/docmux
The crates are on crates.io (cargo install docmux-cli). Feedback on the crate layout or the AST is very welcome.


r/rust • • 3h ago

🛠️ project Introducing EVMTraceX — An Open-Source Rust Tool for Exploring EVM Execution Traces

Post image
0 Upvotes

Introducing EVMTraceX — An Open-Source Rust Tool for Exploring EVM Execution Traces

I've been building **EVMTraceX**, an open-source, terminal-first tool for exploring EVM transaction execution traces.

The goal is to make complex transaction behavior easier to inspect, understand, and debug directly from your terminal.

### Key Capabilities:

* **Nested Call Trees:** Explore execution flows and navigate individual call frames with keyboard-driven precision.

* **Execution Details:** Inspect call types, function selectors, gas usage, errors, and exact revert reasons.

* **Storage Tracking:** Investigate storage state changes alongside the main execution flow.

* **Trace Filtering:** Isolate reverted frames, storage diffs, and specific execution paths to eliminate noise.

* **Flexible Input:** Load supported Geth-style trace JSON files or inspect completed transactions through a compatible RPC endpoint.

Built in Rust (utilizing Ratatui for the TUI), EVMTraceX is designed for high-performance, local-first analysis.

> *Note: It is an engineering analysis tool for developers and auditors, not an automated vulnerability scanner.*

I'm building this as part of Ghost Labs, an independent R&D and software engineering studio.

### Feedback & Discussion

I'd love to hear from fellow developers, EVM engineers, and security researchers:

* What do you find most difficult or painful when investigating complex EVM transactions?

* What additional features, TUI views, or trace formats would make your workflow smoother?

Feedback, issues, and contributions are greatly appreciated!


r/rust • • 12h ago

🗞️ news First Test & Evaluation Report for TRACTOR C to Rust Translators

Thumbnail github.com
21 Upvotes

Two 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 • • 8h ago

🙋 seeking help & advice Rust vs C :: which is going to be the future in embedded

Thumbnail
0 Upvotes

r/rust • • 3m ago

Cargo and rustup are harmful additions to the language

• Upvotes

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 • • 1h ago

раст

• Upvotes

растеры кто подключал на расте библеотеки на линуксе скажите как правильно карго настроить и библеотеку подключить и у меня q4os tde линукс я не где не нашел как нормально карго настроить и библеотеку подключить на мой линукс подскажите пожалуйста


r/rust • • 7h ago

🎙️ discussion What are your opinions about starting an organization

0 Upvotes

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.

Github


r/rust • • 12h ago

📅 this week in rust This Week in Rust #673

Thumbnail this-week-in-rust.org
26 Upvotes

r/rust • • 17h ago

🗞️ news Rust 1.99.1

Thumbnail blog.rust-lang.org
215 Upvotes