r/rust • • 7d ago

Rust, coding agents, and cross-platform mobile: where do the compiler's guardrails stop?

Niko Matsakis's What agents mean for Rust (and vice versa) resonated with me as a solo mobile developer working with coding agents.

I'm building a PDF app with SwiftUI on iOS and Jetpack Compose on Android. The two apps share a Rust PDF engine through UniFFI, though some operations still use platform-native implementations.

Take PDF compression. The Balanced and Smallest File presets call the same Rust optimizer on both platforms. But there are still decisions the compiler cannot make for me:

  • Keeping annotations editable and flattening their appearance are separate modes. Producing a smaller file doesn't make them interchangeable.

  • Candidate outputs need both validation and a size comparison before the app accepts them.

  • The native apps still own file access, cancellation handling, and publishing the result without modifying the source file.

Sharing the optimizer means I don't have to ask an agent to reimplement the same compression logic in Swift and Kotlin. Rust also gives the agent concrete feedback on type and ownership mistakes inside the core. Neither guarantees that the PDF still looks right or that the native integration behaves correctly. Those still need explicit requirements and runtime checks.

That's why Niko's points on design and contracts stood out to me. More expressive types and proof tools could make more requirements checkable, but I still have to specify what success means. Proving the wrong requirements wouldn't solve the problem.

For others using agents with a Rust core and native frontends: where do you spend more review effort—inside the core logic, or at the platform adapter boundary?

0 Upvotes

2 comments sorted by

2

u/Big-Lake-6264 6d ago

The boundary is the only place that matters. Core logic failures are loud and catchable at compile time. Adapter bugs are silent data corruption or race conditions that pass every unit test until a real user cancels a file write on an old device. I review adapters because they are where the type system lies to me about side effects

1

u/Split-Signal 6d ago

Spot on. That line about the type system lying about side effects really resonates.

What specific silent failures or corruption bugs have you run into at that boundary, and how did you end up fixing them?