Hi, so there is this tiling window manager called dwl (which is similar to dwm except dwl is for wayland whereas dwm is for x11) which allows me to configure the entire tiling window manager in C lang.
However I wanted to use Rust instead of C.
If I build the entire project, it will create a config.h file. I am supposed to be playing with config.h file to configure this config file. But I am wondering like maybe I should keep the rest of the C files C, but for the config.h I want to use Rust instead.
If the entire project is in C, why would you bother creating a separation configuration handler in Rust? You'll have to come up with a way to parse the configuration you'd like to manage yourself through a separate file and/or command line and put it back into that C header file anyway, even if you do.
Why complicate things for yourself further if there's a way to keep them much simpler?
I'm not specifically experienced with dwl, but to me it looks like you are probably better off in this case just using C. I think using Rust would probably over-complicate it.
Correct - and you don't like the idea of editing it manually?
What exactly do you mean by using Rust over C here? As previously, you said that:
If that's the case, you'll need to go through all the options you can set up in that header file, create some separate program to handle configuration for you, in Rust, which generates that same file, before building the whole project the way it was meant to be done.
Now you want to convert the whole project? You could use a tool like that, sure - then manually edit all the code bit by bit, getting rid of the unsafe and coming up with safer alternatives that would satisfy Rust. Are you sure you have the time and the energy to do that just to use a language you like?
It's possible, sure - and it's most likely going to mess the code significantly, as programming in C is quite different than programming in Rust. Could be a fun learning experience, though.
Most likely it would not be that simple. It seems like a program that takes a C header config file is probably the worst case scenario for just being able to use C2Rust, because the program itself is designed specifically to use C, and in a way that is not natural from Rust, due to the way cargo works.
So I think that converting it is probably not worth your time, unless you are OK with a lot of work.
Agree with that part. But I think in this case it probably is much easier just to use C.