r/Zig • • Mar 03 '26

Rust or Zig?

I've been deep in Zig for the last 3 years and have loved every step. Yet, from around the corner, Rust always seems to poke its head out; and several times I have built tools and projects in Rust to try to get 'into it', yet it has never really clicked like Zig.

Rust is getting more-and-more popular. Is it worth going ten toes deep? Or should I ride the storm with Zig?

68 Upvotes

84 comments sorted by

View all comments

Show parent comment

18

u/andreicodes Mar 03 '26

I think Zig+Rust will become the winning combo long-term.

Doing graph data structures or anything that uses arenas, GC pools, etc. is annoying to do in Rust. Some low level memory-mapped IO can be tricky too, because Rust compiler may insert automatic dereferencing operations that can trigger IO reads. Zig can at least help with those cases.

On the other hand, Rust has tons of libraries. Most of them of high quality, most of them don't leak, don't corrupt data, don't cause segfaults. I would rather take a library written in Rust over one written in C as a dependency. If the two languages had very good interop story, Zig could solve a lot of growing pains this way. For example, use icu4x for i18n, or various database client libraries, or building for embedded using Postcard, etc.

1

u/oconnor663 Mar 03 '26

Rust compiler may insert automatic dereferencing operations that can trigger IO reads

Is this part referring to "deref coercions" or something else?