diff --git a/packages/lib/src/globals/net.rs b/packages/lib/src/globals/net.rs index 77bb477..d7d1a77 100644 --- a/packages/lib/src/globals/net.rs +++ b/packages/lib/src/globals/net.rs @@ -14,10 +14,10 @@ use reqwest::{ClientBuilder, Method}; use tokio::{sync::mpsc::Sender, task}; use crate::utils::{ + message::LuneMessage, net::{get_request_user_agent_header, NetClient}, table::TableBuilder, }; -use crate::LuneMessage; pub fn create(lua: &Lua) -> LuaResult<()> { // Create a reusable client for performing our diff --git a/packages/lib/src/lib.rs b/packages/lib/src/lib.rs index 9efdc65..1252620 100644 --- a/packages/lib/src/lib.rs +++ b/packages/lib/src/lib.rs @@ -11,7 +11,7 @@ use crate::{ create_fs, create_net, create_process, create_require, create_stdio, create_task, create_top_level, }, - utils::formatting::pretty_format_luau_error, + utils::{formatting::pretty_format_luau_error, message::LuneMessage}, }; #[derive(Clone, Debug, PartialEq, Eq, Hash)] @@ -39,14 +39,6 @@ impl LuneGlobal { } } -#[derive(Debug)] -pub(crate) enum LuneMessage { - Exit(u8), - Spawned, - Finished, - LuaError(LuaError), -} - #[derive(Clone, Debug, Default)] pub struct Lune { globals: HashSet, diff --git a/packages/lib/src/utils/message.rs b/packages/lib/src/utils/message.rs new file mode 100644 index 0000000..50f94c9 --- /dev/null +++ b/packages/lib/src/utils/message.rs @@ -0,0 +1,9 @@ +use mlua::prelude::*; + +#[derive(Debug, Clone)] +pub enum LuneMessage { + Exit(u8), + Spawned, + Finished, + LuaError(LuaError), +} diff --git a/packages/lib/src/utils/mod.rs b/packages/lib/src/utils/mod.rs index 56c7591..dcf93ed 100644 --- a/packages/lib/src/utils/mod.rs +++ b/packages/lib/src/utils/mod.rs @@ -1,5 +1,6 @@ pub mod formatting; pub mod futures; +pub mod message; pub mod net; pub mod process; pub mod table; diff --git a/packages/lib/src/utils/process.rs b/packages/lib/src/utils/process.rs index af4e344..e08f214 100644 --- a/packages/lib/src/utils/process.rs +++ b/packages/lib/src/utils/process.rs @@ -3,9 +3,7 @@ use std::{process::ExitStatus, sync::Weak, time::Duration}; use mlua::prelude::*; use tokio::{io, process::Child, sync::mpsc::Sender, task::spawn, time::sleep}; -use crate::LuneMessage; - -use super::futures::AsyncTeeWriter; +use crate::utils::{futures::AsyncTeeWriter, message::LuneMessage}; pub async fn pipe_and_inherit_child_process_stdio( mut child: Child, diff --git a/packages/lib/src/utils/task.rs b/packages/lib/src/utils/task.rs index c446a48..8a14f23 100644 --- a/packages/lib/src/utils/task.rs +++ b/packages/lib/src/utils/task.rs @@ -6,7 +6,7 @@ use mlua::prelude::*; use tokio::sync::mpsc::Sender; use tokio::task; -use crate::LuneMessage; +use crate::utils::message::LuneMessage; #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub enum TaskRunMode {