Skip to content

v0.12.0

Latest

Choose a tag to compare

@khvzak khvzak released this 05 Jul 22:56
v0.12.0
8eddf85

Highlights

More ergonomic UserData building blocks

  • Declaratively implement UserData with #[derive(UserData)] and register methods/fields with the new #[mlua::userdata_impl] attribute macro.
  • UserDataOwned<T> wrapper takes ownership of userdata and implements FromLua
  • UserDataMethods::add_method_once/add_async_method_once
  • __todebugstring metamethod for pretty-printing userdata when debugging
  • MaybeSync trait for userdata under the send feature

Reorganized public API

Types are now grouped into focused modules: chunk, debug, error, function, table, string, state, thread, userdata and luau.

Thread lifecycle callbacks

Hook into coroutine create/resume/yield events across all Lua versions (when using mlua API).

Luau improvements

Latest Luau with extended require-by-string support and JIT options.

Garbage-collector interface refactor

Lua::gc_inc / Lua::gc_gen are replaced by a Lua::gc_set_mode, with GcIncParams/GcGenParams for fine-grained tuning.

What's Changed (since v0.12.0-rc.2)

  • Crate root re-exports are refactored (only essentials are re-exported, the rest is in the new submodules)
  • Added ThreadStatus::Normal and Thread::is_normal (mimic coroutine.status)
  • Added Lua::set_jit_options with support of Luau JIT inliner (Luau)
  • Added Value::as_vector/Value::is_vector (Luau)
  • Added Table::remove
  • serde: tables with the array metatable are always encoded as arrays (incl. detect_mixed_tables option)
  • impl Hash for BorrowedStr/BorrowedBytes
  • Lua::current_thread resolves implicit async threads to their root owner (#706)
  • Bugfixes and improvements

Full Changelog: v0.11.6...v0.12.0