diff --git a/procinfo/Cargo.toml b/procinfo/Cargo.toml index 089c06c3f..42de47e78 100644 --- a/procinfo/Cargo.toml +++ b/procinfo/Cargo.toml @@ -4,12 +4,15 @@ version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +default = ["lua"] +lua = ["dep:luahelper", "dep:wezterm-dynamic"] [dependencies] libc = "0.2" log = "0.4" -luahelper = { path = "../luahelper" } -wezterm-dynamic = { path = "../wezterm-dynamic" } +luahelper = { path = "../luahelper", optional = true } +wezterm-dynamic = { path = "../wezterm-dynamic", optional = true } [target."cfg(windows)".dependencies] ntapi = "0.3" diff --git a/procinfo/src/lib.rs b/procinfo/src/lib.rs index 461138b01..08f042364 100644 --- a/procinfo/src/lib.rs +++ b/procinfo/src/lib.rs @@ -1,12 +1,15 @@ use std::collections::{HashMap, HashSet}; use std::path::PathBuf; + +#[cfg(feature = "lua")] use wezterm_dynamic::{FromDynamic, ToDynamic}; mod linux; mod macos; mod windows; -#[derive(Debug, Copy, Clone, FromDynamic, ToDynamic)] +#[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "lua", derive(FromDynamic, ToDynamic))] pub enum LocalProcessStatus { Idle, Run, @@ -22,7 +25,8 @@ pub enum LocalProcessStatus { Unknown, } -#[derive(Debug, Clone, FromDynamic, ToDynamic)] +#[derive(Debug, Clone)] +#[cfg_attr(feature = "lua", derive(FromDynamic, ToDynamic))] pub struct LocalProcessInfo { /// The process identifier pub pid: u32, @@ -55,6 +59,7 @@ pub struct LocalProcessInfo { /// Child processes, keyed by pid pub children: HashMap, } +#[cfg(feature = "lua")] luahelper::impl_lua_conversion_dynamic!(LocalProcessInfo); impl LocalProcessInfo {