-
-
Notifications
You must be signed in to change notification settings - Fork 96
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
alerque
wants to merge
9
commits into
master
Choose a base branch
from
cargo-workspace-inplace
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alerque
force-pushed
the
cargo-workspace-inplace
branch
2 times, most recently
from
June 24, 2024 22:43
e4e8c33
to
0310afb
Compare
alerque
force-pushed
the
cargo-workspace-inplace
branch
from
June 25, 2024 11:30
0310afb
to
56c593f
Compare
alerque
force-pushed
the
cargo-workspace-inplace
branch
from
June 28, 2024 10:48
56c593f
to
c147387
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.