From 86cfbca33e9b73c8d7565387f6df50fe968a2dd4 Mon Sep 17 00:00:00 2001 From: Markus <28785953+MarkusJx@users.noreply.github.com> Date: Mon, 27 Feb 2023 10:31:03 +0100 Subject: [PATCH] feat(napi): expose uv_run (#1499) Signed-off-by: MarkusJx <28785953+MarkusJx@users.noreply.github.com> --- crates/sys/src/functions.rs | 3 +++ crates/sys/src/types.rs | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/crates/sys/src/functions.rs b/crates/sys/src/functions.rs index 3041d1e4..372f8705 100644 --- a/crates/sys/src/functions.rs +++ b/crates/sys/src/functions.rs @@ -487,10 +487,13 @@ mod napi1 { #[cfg(feature = "napi2")] mod napi2 { use super::super::types::*; + use std::os::raw::c_int; generate!( extern "C" { fn napi_get_uv_event_loop(env: napi_env, loop_: *mut *mut uv_loop_s) -> napi_status; + + fn uv_run(loop_: *mut uv_loop_s, mode: uv_run_mode) -> c_int; } ); } diff --git a/crates/sys/src/types.rs b/crates/sys/src/types.rs index 4eda84e8..27ea384e 100644 --- a/crates/sys/src/types.rs +++ b/crates/sys/src/types.rs @@ -55,6 +55,13 @@ pub struct napi_deferred__ { pub struct uv_loop_s { _unused: [u8; 0], } +#[repr(C)] +#[derive(Copy, Clone)] +pub enum uv_run_mode { + UV_RUN_DEFAULT = 0, + UV_RUN_ONCE = 1, + UV_RUN_NOWAIT = 2, +} pub type napi_deferred = *mut napi_deferred__; pub type napi_property_attributes = i32;