Skip to content

Commit a2d8b21

Browse files
committed
Make luau module public
1 parent a9604c4 commit a2d8b21

File tree

6 files changed

+28
-8
lines changed

6 files changed

+28
-8
lines changed

src/function.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ impl Function {
246246
/// # }
247247
/// ```
248248
///
249-
/// [`AsyncThread`]: crate::AsyncThread
249+
/// [`AsyncThread`]: crate::thread::AsyncThread
250250
#[cfg(feature = "async")]
251251
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
252252
pub fn call_async<R>(&self, args: impl IntoLuaMulti) -> AsyncCallFuture<R>

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ mod buffer;
7676
mod chunk;
7777
mod conversion;
7878
mod error;
79-
#[cfg(any(feature = "luau", doc))]
80-
mod luau;
8179
mod memory;
8280
mod multi;
8381
mod scope;
@@ -91,6 +89,9 @@ mod vector;
9189

9290
pub mod debug;
9391
pub mod function;
92+
#[cfg(any(feature = "luau", doc))]
93+
#[cfg_attr(docsrs, doc(cfg(feature = "luau")))]
94+
pub mod luau;
9495
pub mod prelude;
9596
pub mod string;
9697
pub mod table;
@@ -147,7 +148,6 @@ pub use crate::debug::HookTriggers;
147148
pub use crate::{
148149
buffer::Buffer,
149150
chunk::{CompileConstant, Compiler},
150-
luau::{FsRequirer, HeapDump, NavigateError, Require},
151151
vector::Vector,
152152
};
153153

src/luau/mod.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
//! Luau-specific extensions and types.
2+
//!
3+
//! This module provides Luau-specific functionality including custom `require` implementations,
4+
//! heap memory analysis, and Luau VM integration utilities.
5+
//!
6+
//! # Overview
7+
//!
8+
//! - [`Require`] — trait for implementing custom module loaders used with
9+
//! [`Lua::create_require_function`]
10+
//! - [`FsRequirer`] — default filesystem-based [`Require`] implementation
11+
//! - [`NavigateError`] — error type returned when navigating the module path
12+
//! - [`HeapDump`] — snapshot of Luau heap memory usage, obtained via [`Lua::heap_dump`]
13+
//!
14+
//! [`Lua::create_require_function`]: crate::Lua::create_require_function
15+
//! [`Lua::heap_dump`]: crate::Lua::heap_dump
16+
117
use std::ffi::{CStr, CString};
218
use std::os::raw::c_int;
319
use std::ptr;

src/prelude.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ pub use crate::HookTriggers as LuaHookTriggers;
2525
#[cfg(feature = "luau")]
2626
#[doc(no_inline)]
2727
pub use crate::{
28-
CompileConstant as LuaCompileConstant, Compiler as LuaCompiler, FsRequirer as LuaFsRequirer,
29-
NavigateError as LuaNavigateError, Require as LuaRequire, Vector as LuaVector,
28+
CompileConstant as LuaCompileConstant, Compiler as LuaCompiler, Vector as LuaVector,
29+
luau::{
30+
FsRequirer as LuaFsRequirer, HeapDump as LuaHeapDump, NavigateError as LuaNavigateError,
31+
Require as LuaRequire,
32+
},
3033
};
3134

3235
#[cfg(feature = "async")]

src/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1456,7 +1456,7 @@ impl Lua {
14561456
/// }
14571457
/// ```
14581458
///
1459-
/// [`AsyncThread`]: crate::AsyncThread
1459+
/// [`AsyncThread`]: crate::thread::AsyncThread
14601460
#[cfg(feature = "async")]
14611461
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
14621462
pub fn create_async_function<F, A, FR, R>(&self, func: F) -> Result<Function>

tests/luau/require.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use std::io::Result as IoResult;
22
use std::result::Result as StdResult;
33

4-
use mlua::{Error, FromLua, FsRequirer, IntoLua, Lua, MultiValue, NavigateError, Require, Result, Value};
4+
use mlua::luau::{FsRequirer, NavigateError, Require};
5+
use mlua::{Error, FromLua, IntoLua, Lua, MultiValue, Result, Value};
56

67
fn run_require(lua: &Lua, path: impl IntoLua) -> Result<Value> {
78
lua.load(r#"return require(...)"#).call(path)

0 commit comments

Comments
 (0)