pub struct NativeResolver { /* private fields */ }Expand description
Resolver that builds Lua Values directly from Rust functions.
Provides native modules like @std/http.
Since the factory function returns a Lua Value, table construction
and function registration are fully controlled on the Rust side.
use mlua_pkg::resolvers::NativeResolver;
use mlua::Value;
let r = NativeResolver::new().add("@std/version", |lua| {
lua.create_string("1.0.0").map(Value::String)
});Implementations§
Trait Implementations§
Source§impl Default for NativeResolver
impl Default for NativeResolver
Auto Trait Implementations§
impl Freeze for NativeResolver
impl !RefUnwindSafe for NativeResolver
impl Send for NativeResolver
impl Sync for NativeResolver
impl Unpin for NativeResolver
impl UnsafeUnpin for NativeResolver
impl !UnwindSafe for NativeResolver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more