Struct oxi_libuv::AsyncHandle
source · pub struct AsyncHandle { /* private fields */ }
Expand description
Binding to libuv’s Async handle used to trigger the execution of a callback in the Neovim thread.
Implementations§
source§impl AsyncHandle
impl AsyncHandle
sourcepub fn new<E, Cb>(callback: Cb) -> Result<Self, Error>where
E: StdError + 'static,
Cb: FnMut() -> Result<(), E> + 'static,
pub fn new<E, Cb>(callback: Cb) -> Result<Self, Error>where E: StdError + 'static, Cb: FnMut() -> Result<(), E> + 'static,
Registers a new callback on the Neovim event loop, returning an
AsyncHandle
which can be used to execute the callback from any
thread. The callback will always be executed on the main thread.
sourcepub fn send(&self) -> Result<(), Error>
pub fn send(&self) -> Result<(), Error>
Wakes up the Neovim event loop and executes the callback associated to this handle. It is safe to call this function from any thread. The callback will be called on the main thread.
NOTE: libuv will coalesce calls to AsyncHandle::send
, that is,
not every call to it will yield an execution of the callback. For
example: if AsyncHandle::send
is called 5 times in a row before the
callback is called, the callback will only be called once. If
AsyncHandle::send
is called again after the callback was called, it
will be called again.
Trait Implementations§
source§impl Clone for AsyncHandle
impl Clone for AsyncHandle
source§fn clone(&self) -> AsyncHandle
fn clone(&self) -> AsyncHandle
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more