⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content
Discussion options

You must be logged in to vote

Ok, so this is slightly insane, but the following works perfectly:

use std::ffi::{CString, c_int, c_void};

use mlua::{AnyUserData, Function, Lua, Result};

use crate::lua_error;

/// A libuv [`uv_async_t`][1] handle that can be used to wake up the main thread and call a function.
/// The passed callback is automatically wrapped in `vim.schedule`.
///
/// [1]: https://docs.libuv.org/en/v1.x/async.html
#[derive(Clone)]
pub struct AsyncHandle(*mut c_void, AnyUserData);

// The `uv_async_t` is safe to be called from any thread.
// However, the AnyUserData reference must be called from the main thread, so all functions that
// act on it should accept a Lua handle and use it to call the functi…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by happenslol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant