Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup Lua module for exporting Rust functions to Lua #2072

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

alerque
Copy link
Member

@alerque alerque commented Jun 15, 2024

To date we've only had a Rust wrapper with a few strings stuffed in then running an almost entirely Lua code base. An obvious benefit of having Rust at our finger tips is going to be access to different libraries and bindings and speed and type checking and such. But there hasn't been an ergonomic way to start reaching into that toolbox yet. I did some POC work several times before I went down the Rust road so I know it would be possible, but v0.15.0 just had the CLI wrapper.

The current draft of #2064 is the first real function from the Rust side being passed over to Lua. But that approach isn't very sustainable, and it completely breaks compatibility with Lua. We're closer than ever to being able to easily be used as a library from Lua (and with just a little more futzing, also Python, Node, and others). So I don't actually want to go down that road.

Instead I want to make all the Rust API surface we wast to use available on the Lua side via a module that can be built and installed on it's own.

Unfortunately the mlua library can't use the vendored feature at the same time as the module feature, so we have to split out a separate crate for it. This PR does that.

We'll probably want to keep all the code and logic in the sile create's lib and just use the rusile crate to export modules to Lua/Python/whatever. And we'll probably want proc macros to wrap the functions with the right bindings, but that can come later.

As of posting the Lua module builds and runs code, but isn't loaded back into the SILE runtime namespace.

@alerque alerque added this to the v0.15.x milestone Jun 15, 2024
@alerque alerque force-pushed the cargo-workspace-inplace branch 2 times, most recently from e4e8c33 to 0310afb Compare June 24, 2024 22:43
@sile-typesetter sile-typesetter deleted a comment from coveralls Jun 24, 2024
@sile-typesetter sile-typesetter deleted a comment from coveralls Jun 24, 2024
@alerque alerque modified the milestones: v0.15.x, v0.15.5 Jun 27, 2024
@coveralls
Copy link

Coverage Status

coverage: 68.15% (+3.3%) from 64.818%
when pulling c147387 on cargo-workspace-inplace
into b738c1c on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants