Comments (6)
The two main reasons are:
- performance: when using mlua you're calling the Neovim Lua api, i.e. Lua bindings to the C api. This means that all the Rust values are first converted to Lua values, then you call the Lua api, then Neovim converts those values back to C.
Since all the Neovim C functions are exported we can avoid all of that by hooking straight into the C api via ffi, effectively turning
Rust -> Lua, Lua -> C
into
Rust -> C
- integration: mlua is a fantastic crate, but it is a general purpose one. I believe there's a lot of value in having a more vertically integrated framework that's tailored specifically to Neovim, allowing you to take full advantage of Rust's type system. Examples are still scarce since
nvim-oxi
is still far from ready but you'll see what I mean.
from nvim-oxi.
I didn't explain the question properly. I understand using neovim C functions directly.
But I don't understand why we are using lua C function directly (in nvim-oxi/src/lua). It is hard to get correct and just creates additional work.
from nvim-oxi.
we are using lua C function directly (in nvim-oxi/src/lua)
We don't? I'm not sure what you mean by "lua C function". Could you link the module/line?
from nvim-oxi.
these
nvim-oxi/nvim-oxi/src/lua/ffi.rs
Lines 45 to 53 in de5afb5
from nvim-oxi.
Yes, those are needed.
from nvim-oxi.
Yes, those are needed.
Yes that is question, why deal with unsafe ffi ourselves, instead of using mlua in module mode.
from nvim-oxi.
Related Issues (20)
- Trying to use oxi::api::call_function() but I'm not sure how to map into a dictionary HOT 1
- This crate is causing neovim to crash on the latest commit HOT 4
- Test complete API
- The libuv example doesn't work HOT 2
- Can't locate `lua_pushlstring`
- Simple code error, help! HOT 1
- How to perform the api of nvim in other processes HOT 1
- [Windows][Powershell7] cannot find type `PathBuf` in this scope HOT 3
- [Windows][Powershell7] linking with `link.exe` failed: exit code: 1120 HOT 5
- [Ubuntu] Error while calling lua chunk... undefined symbol: luaopen_... HOT 1
- support derive
- [help] How to call other lua plugin exposed methods HOT 4
- Crash when loading the example plugin on Windows HOT 29
- Test macro doesn't seem to pick up on failures HOT 6
- nvim_oxi::api::types::Mode doesn't allow for Remap ("m") mode HOT 2
- Add Installation Instructions HOT 1
- `println!` writes to nvim process HOT 4
- Not sure you answered my question HOT 2
- Can't find buffer number from `Buffer` HOT 5
- Use LuaFunction as `rhs` for `buffer_keymap_set` that should capture local variable HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nvim-oxi.