146
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
this post was submitted on 15 Jul 2026
146 points (96.8% liked)
Rust
8363 readers
11 users here now
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Wormhole
Credits
- The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)
founded 3 years ago
MODERATORS
Why are you considering Zig instead of Rust? Or is it in addition?
i like the way zig interfaces with c. even though it's a "newer" (not 1.0) language you can import native c which means you have access to already really fast libraries. the build script and macros are the same language you write your code. the best part is you can interface with normal code (not unsafe) and can create boundaries where sure in the c side you can't enforce memory safety, but where you interface you can convert into memory safe types.
to talk more about memory safety i think rust does a great job, however there are some inconsistentcies where a lot of memory allocations can throw out of memory errors that will crash the app whereas zig you could gracefully handle it. this is probably more important for lower level things like kernel than an app where not recovering means everything goes down.
honestly i wish there was an opt in borrow checker as some patterns are easily expressed, but honestly i would opt out for async code as it just gets verbosely over-declarative imo. also the new async in zig is really really cool.
You can trivially use C libraries in Rust, or any system language that supports the C ABI for that matter, and this includes many hobbyist languages. Zig is not special.
No Zig definitely is special. You don't have to do any extra busy work to call C code - you can pretty much just
#includethe header and that's that. It's similar to calling C from C++.In any other languages - including Rust - you have to do some work declaring functions, wrapping them and so on. It's not hard but it definitely is a non-zero amount of tedious work (especially before AI). There's absolutely no way you could describe it as "trivial", unless someone else has already done that work for you.
But I don't think it is a significant Zig advantage really. When I'm writing Rust, it's extremely rare that I want to call any C code that someone else hasn't already done the tedious wrapping for.
You know
bindgenexists, right?Yes. It's not as easy and reliable as Zig.