From 6a289583bfc2afea194f9df26cfeecf141123fe8 Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Tue, 21 Mar 2023 16:53:09 +0100 Subject: [PATCH] Shuffle some code around, update changelog --- CHANGELOG.md | 4 ++++ packages/lib/src/globals/net.rs | 5 +++-- packages/lib/src/globals/serde.rs | 2 +- packages/lib/src/lua/mod.rs | 1 + packages/lib/src/lua/net/mod.rs | 2 -- .../lib/src/lua/{net/serde.rs => serde/encode_decode.rs} | 0 packages/lib/src/lua/serde/mod.rs | 3 +++ 7 files changed, 12 insertions(+), 5 deletions(-) rename packages/lib/src/lua/{net/serde.rs => serde/encode_decode.rs} (100%) create mode 100644 packages/lib/src/lua/serde/mod.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index d7d544d..427b82b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 This built-in contains previously available functions `encode` and `decode` from the `net` global.
Note that this is **_only_** available using the new `require` syntax, and is not available as a global. +### Changed + +- Renamed the global `info` function to `printinfo` to make it less ambiguous + ### Removed - Removed experimental `net.encode` and `net.decode` functions, since they are now available using `require("@lune/serde")` diff --git a/packages/lib/src/globals/net.rs b/packages/lib/src/globals/net.rs index 6089e31..0c1f8a4 100644 --- a/packages/lib/src/globals/net.rs +++ b/packages/lib/src/globals/net.rs @@ -8,9 +8,10 @@ use tokio::{sync::mpsc, task}; use crate::lua::{ net::{ - EncodeDecodeConfig, EncodeDecodeFormat, NetClient, NetClientBuilder, NetLocalExec, - NetService, NetWebSocket, RequestConfig, ServeConfig, + NetClient, NetClientBuilder, NetLocalExec, NetService, NetWebSocket, RequestConfig, + ServeConfig, }, + serde::{EncodeDecodeConfig, EncodeDecodeFormat}, table::TableBuilder, task::{TaskScheduler, TaskSchedulerAsyncExt}, }; diff --git a/packages/lib/src/globals/serde.rs b/packages/lib/src/globals/serde.rs index 24674df..9beaf5e 100644 --- a/packages/lib/src/globals/serde.rs +++ b/packages/lib/src/globals/serde.rs @@ -1,7 +1,7 @@ use mlua::prelude::*; use crate::lua::{ - net::{EncodeDecodeConfig, EncodeDecodeFormat}, + serde::{EncodeDecodeConfig, EncodeDecodeFormat}, table::TableBuilder, }; diff --git a/packages/lib/src/lua/mod.rs b/packages/lib/src/lua/mod.rs index 90f2572..12c39cd 100644 --- a/packages/lib/src/lua/mod.rs +++ b/packages/lib/src/lua/mod.rs @@ -4,6 +4,7 @@ pub mod async_ext; pub mod fs; pub mod net; pub mod process; +pub mod serde; pub mod stdio; pub mod table; pub mod task; diff --git a/packages/lib/src/lua/net/mod.rs b/packages/lib/src/lua/net/mod.rs index 604b1d3..c52b780 100644 --- a/packages/lib/src/lua/net/mod.rs +++ b/packages/lib/src/lua/net/mod.rs @@ -1,11 +1,9 @@ mod client; mod config; mod response; -mod serde; mod server; mod websocket; -pub use self::serde::{EncodeDecodeConfig, EncodeDecodeFormat}; pub use client::{NetClient, NetClientBuilder}; pub use config::{RequestConfig, ServeConfig}; pub use response::{NetServeResponse, NetServeResponseKind}; diff --git a/packages/lib/src/lua/net/serde.rs b/packages/lib/src/lua/serde/encode_decode.rs similarity index 100% rename from packages/lib/src/lua/net/serde.rs rename to packages/lib/src/lua/serde/encode_decode.rs diff --git a/packages/lib/src/lua/serde/mod.rs b/packages/lib/src/lua/serde/mod.rs new file mode 100644 index 0000000..6cbbbcf --- /dev/null +++ b/packages/lib/src/lua/serde/mod.rs @@ -0,0 +1,3 @@ +mod encode_decode; + +pub use encode_decode::{EncodeDecodeConfig, EncodeDecodeFormat};