We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It should be possible to pass a Rust closure everywhere one would pass a Lua function when using the Lua API.
Just as an example, something like
local print_current_modified = function() local buf = vim.api.nvim_get_current_buf() local is_modified = vim.api.nvim_buf_call(buf, function() return vim.api.nvim_buf_get_option(0, "modified") end) print(is_modified) end
should become
use nvim_oxi as nvim; fn print_current_modified() -> nvim::Result<()> { let buf = nvim::api::get_current_buf(); let is_modified = buf.call(|| { nvim::Buffer::from(0).get_option::<bool>("modified") })?; nvim::print!("{is_modified}"); Ok(()) }
Functions should accept FnOnce or FnMut closures on a case-by-case basis, but always with a 'static bound.
FnOnce
FnMut
'static
The text was updated successfully, but these errors were encountered:
No branches or pull requests
It should be possible to pass a Rust closure everywhere one would pass a Lua function when using the Lua API.
Just as an example, something like
should become
Functions should accept
FnOnce
orFnMut
closures on a case-by-case basis, but always with a'static
bound.The text was updated successfully, but these errors were encountered: