From e47555fd86da3267701da2cb323de0d988565127 Mon Sep 17 00:00:00 2001 From: highflowey Date: Sat, 24 Aug 2024 16:27:47 +0330 Subject: [PATCH] make StandardLibrary trait public --- crates/lune-std/src/lib.rs | 5 ++--- crates/lune-std/src/library.rs | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/crates/lune-std/src/lib.rs b/crates/lune-std/src/lib.rs index f91d9b3..508a891 100644 --- a/crates/lune-std/src/lib.rs +++ b/crates/lune-std/src/lib.rs @@ -1,7 +1,5 @@ #![allow(clippy::cargo_common_metadata)] -pub use globals::require::context::RequireContext; - use mlua::prelude::*; mod global; @@ -11,8 +9,9 @@ mod luaurc; mod path; pub use self::global::LuneStandardGlobal; +pub use self::globals::require::context::RequireContext; pub use self::globals::version::set_global_version; -pub use self::library::LuneStandardLibrary; +pub use self::library::{LuneStandardLibrary, StandardLibrary}; /** Injects all standard globals into the given Lua state / VM. diff --git a/crates/lune-std/src/library.rs b/crates/lune-std/src/library.rs index 4f7745e..2097bb6 100644 --- a/crates/lune-std/src/library.rs +++ b/crates/lune-std/src/library.rs @@ -6,8 +6,18 @@ pub trait StandardLibrary where Self: Debug, { + /** + Gets the name of the library, such as `datetime` or `fs`. + */ fn name(&self) -> &'static str; + /** + Creates the Lua module for the library. + + # Errors + + If the library could not be created. + */ fn module<'lua>(&self, lua: &'lua Lua) -> LuaResult>; } @@ -49,9 +59,6 @@ impl LuneStandardLibrary { } impl StandardLibrary for LuneStandardLibrary { - /** - Gets the name of the library, such as `datetime` or `fs`. - */ #[must_use] #[rustfmt::skip] #[allow(unreachable_patterns)] @@ -72,13 +79,6 @@ impl StandardLibrary for LuneStandardLibrary { } } - /** - Creates the Lua module for the library. - - # Errors - - If the library could not be created. - */ #[rustfmt::skip] #[allow(unreachable_patterns)] fn module<'lua>(&self, lua: &'lua Lua) -> LuaResult> {