Creating Bat-c: A C Wrapper For Rust's Bat Library In Crystal
Creating `bat-c`, a C wrapper for Rust's `bat` syntax highlighting lib, & making it callable from Crystal. Challenges include large library size & inefficient internal structure. Sample code & GitHub Actions integration provided.
Introduction Hello! Have you heard of the command-line tool bat, written in Rust? bat is a command-line tool similar to cat that displays file contents in the terminal, but with additional features like line numbering, syntax highlighting, and paging. bat hello.rb On the other hand, Crystal currently lacks a powerful syntax highlighting library. So, I thought about using bat as a library to solve this problem. Bat Can Also Be Used as a Rust Library In fact, Bat can also be used as a Rust library. This is possible through the PrettyPrinter struct. use bat::...