Embedding Lua into Rust

Many of the programs we've discussed in this book use a report thread to notify the user of the running behavior of the program. Each of these report functions have been coded in Rust, an unchanging part of the executable. What if, however, we wanted end-users to be able to supply their own reporting routine? Or, consider the cernan project (https://crates.io/crates/cernan), discussed previously in this book, which supports a programmable filter, an online data-stream filter that can be programmed by end-users without changing the cernan binary. How do you pull such a trick off?

A common answer, not just in Rust but in many compiled languages, is to embed a Lua interpreter (https://www.lua.org/) and read user programs ...

Get Hands-On Concurrency with Rust now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.