This isn't exactly what you're asking for, but if you just want something with a fixed size or capacity that is resistant to copying issues and heap-related bugs, I wrote a library called [stack_strings](https://github.com/termermc/nim-stack-strings) that has a fixed-sized stack-allocated buffer and string heuristics. You can get a pointer to the data and use it as a cstring or array and compare that. If none of that is useful or important to your question, then please disregard.
- creating nimstring using pre-allocated buffer to prevent copy alireza
- creating nimstring using pre-allocated buffer to prevent copy Araq
- creating nimstring using pre-allocated buffer to prevent ... termer