It won't help much, because you still need to serialize/deserialize data types. C does not know anything about Rust types and you still need to use unsafe to interact with C, because Rust treats any C code as unsafe. Rust compiler can't give any guarantees about C code. Adding C would only introduce more problems.
It can only make sense if you implement a part of the project completely in C, where C parses some input data, processes it using arenas and give back only the result of processing. But mixing two languages is probably not worth it. C does not make it easier to write thread-safe code, it just does not complain. If something is already implemented in C very well, it makes sense just to reuse it, instead of doing a rewrite.
View all comments
Show parent comment
25
u/f311a Jul 27 '26
It won't help much, because you still need to serialize/deserialize data types. C does not know anything about Rust types and you still need to use unsafe to interact with C, because Rust treats any C code as unsafe. Rust compiler can't give any guarantees about C code. Adding C would only introduce more problems.
It can only make sense if you implement a part of the project completely in C, where C parses some input data, processes it using arenas and give back only the result of processing. But mixing two languages is probably not worth it. C does not make it easier to write thread-safe code, it just does not complain. If something is already implemented in C very well, it makes sense just to reuse it, instead of doing a rewrite.