[sword-devel] Rust bindings

Greg Hellings greg.hellings at gmail.com
Tue Feb 25 01:30:16 EST 2025


More for the fun of my own, personal enjoyment I spent this evening
tackling a Rust binding for the Sword library. I doubt it will go much of
anywhere, but I was able to get it to a point where it will instantiate an
SWMgr, list the installed modules, return a specific module, allow you to
set the module key (by text only), and retrieve the stripped text of the
module entry.

To prove it was doing the thing I thought, I added a little CLI that does
exactly that - iterate all installed modules, try setting them to a random
verse in John 3:1-20, and print the stripText results to the console.

If you're curious about what the code looks like:
https://src.thehellings.com/greg/sword_rs

This was pretty much just an excuse to learn how to link Rust and C++. It's
probably ugly on both sides of the FFI boundary, but it works!

--Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://crosswire.org/pipermail/sword-devel/attachments/20250225/b1b0cc03/attachment.htm>


More information about the sword-devel mailing list