mirror of
https://github.com/lune-org/lune.git
synced 2025-04-10 21:40:54 +01:00
make StandardLibrary trait public
This commit is contained in:
parent
14d0bcbe9c
commit
e47555fd86
2 changed files with 12 additions and 13 deletions
|
@ -1,7 +1,5 @@
|
||||||
#![allow(clippy::cargo_common_metadata)]
|
#![allow(clippy::cargo_common_metadata)]
|
||||||
|
|
||||||
pub use globals::require::context::RequireContext;
|
|
||||||
|
|
||||||
use mlua::prelude::*;
|
use mlua::prelude::*;
|
||||||
|
|
||||||
mod global;
|
mod global;
|
||||||
|
@ -11,8 +9,9 @@ mod luaurc;
|
||||||
mod path;
|
mod path;
|
||||||
|
|
||||||
pub use self::global::LuneStandardGlobal;
|
pub use self::global::LuneStandardGlobal;
|
||||||
|
pub use self::globals::require::context::RequireContext;
|
||||||
pub use self::globals::version::set_global_version;
|
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.
|
Injects all standard globals into the given Lua state / VM.
|
||||||
|
|
|
@ -6,8 +6,18 @@ pub trait StandardLibrary
|
||||||
where
|
where
|
||||||
Self: Debug,
|
Self: Debug,
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
Gets the name of the library, such as `datetime` or `fs`.
|
||||||
|
*/
|
||||||
fn name(&self) -> &'static str;
|
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<LuaMultiValue<'lua>>;
|
fn module<'lua>(&self, lua: &'lua Lua) -> LuaResult<LuaMultiValue<'lua>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,9 +59,6 @@ impl LuneStandardLibrary {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StandardLibrary for LuneStandardLibrary {
|
impl StandardLibrary for LuneStandardLibrary {
|
||||||
/**
|
|
||||||
Gets the name of the library, such as `datetime` or `fs`.
|
|
||||||
*/
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[allow(unreachable_patterns)]
|
#[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]
|
#[rustfmt::skip]
|
||||||
#[allow(unreachable_patterns)]
|
#[allow(unreachable_patterns)]
|
||||||
fn module<'lua>(&self, lua: &'lua Lua) -> LuaResult<LuaMultiValue<'lua>> {
|
fn module<'lua>(&self, lua: &'lua Lua) -> LuaResult<LuaMultiValue<'lua>> {
|
||||||
|
|
Loading…
Add table
Reference in a new issue