Alex Orlenko
10999babe0
Replace MultiValue::extend_from_values with from_lua_iter
2024-08-06 01:32:20 +01:00
Alex Orlenko
f0a995a357
Make MultiValue::with_capacity public
2024-08-05 23:36:17 +01:00
Alex Orlenko
aa47324ee9
Use pool for MultiValue container
2024-08-05 22:07:19 +01:00
Alex Orlenko
a86d6ab330
Mark LightUserData as Send+Sync (send feature flag)
2024-07-31 13:42:39 +01:00
Alex Orlenko
94415065c0
Fix Lua String soundness when borrowing &str or &[u8].
...
Make borrowing using new `BorrowedStr` and `BorrowedBytes` types that holds strong reference to Lua.
2024-07-31 13:42:38 +01:00
Alex Orlenko
b4892c228c
Add rustfmt.toml
2024-07-31 13:42:37 +01:00
Alex Orlenko
658f2a13ea
Support multi threads under send feature flag
2024-07-31 13:42:37 +01:00
Alex Orlenko
cd6d86a5ce
Split single lua module to multiple submodules under state
2024-07-31 13:42:37 +01:00
Alex Orlenko
7221051683
Refactor:
...
- Remove the rest of `'lua` lifetimes
- Remove Owned types
2024-07-31 13:42:35 +01:00
Alex Orlenko
1eb2ecb3b0
Drop lifetime from IntoLua
2024-07-31 13:42:35 +01:00
Alex Orlenko
aa05eb4c81
Switch MultiValue to use VecDeque under the hood.
2024-07-31 13:42:35 +01:00
Alex Orlenko
4aa178fcc0
Take &Value in Lua::push_value()
2024-07-31 13:42:35 +01:00
Alex Orlenko
98ca880f8a
Change Value::Error variant to store Box<Error> instead of Error.
...
This will help to reduce size of `Value` enum on the stack.
2024-07-31 13:42:34 +01:00
Yiyu Lin
b62f2ee0f7
chore: make clippy happy ( #388 )
...
Co-authored-by: hzlinyiyu <hzlinyiyu@corp.netease.com >
2024-03-25 13:26:06 +00:00
Alex Orlenko
34476ebf53
Support LuaJIT cdata type (produced by ffi module)
2023-11-16 13:33:23 +00:00
Alex Orlenko
5043447f23
Support Luau buffer type and and library.
...
Buffer is an object that represents a fixed-size mutable block of memory and added to Luau 0.601.
See https://luau-lang.org/library#buffer-library for more details.
2023-11-16 12:55:58 +00:00
Alex Orlenko
052310e93d
Update doc for deny_unsupported_types option
2023-08-12 17:40:39 +01:00
Alex Orlenko
09eb7f251b
Support options for Value::serialize() implementation
...
To match `lua.from_value_with()` functionality.
2023-08-12 17:24:57 +01:00
Alex Orlenko
0cb0a345dd
Hide clippy warning converting i32 to i32
2023-08-07 11:44:35 +01:00
Alex Orlenko
3e479be4e5
Cosmetic changes for the Value conversions + add tests
2023-08-06 23:41:27 +01:00
Akase Cho
021ee946fc
Add helper functions to Value ( #299 )
...
Add helper functions to `Value`
2023-08-06 22:44:32 +01:00
Alex Orlenko
cd0c8a4584
Optimize async functionality:
...
Rewrite using the new `push_into_stack()`/`from_stack()` methods.
Also store thread state (pointer) in `Thread` struct to avoid getting it every time.
Async userdata methods still need to have arguments stored in ref thread as stack is empty on every poll().
2023-08-03 00:56:17 +01:00
Alex Orlenko
4fff14a144
impl Drop for MultiValue
...
This action would automatically return container to the pool on drop (instead of doing it manually)
2023-08-01 11:21:26 +01:00
Alex Orlenko
196c09a0d6
New (unsafe and private) methods for IntoLua/FromLua traits: push_into_stack/from_stack.
...
They allow to push Value directly to Lua stack or get Value from Lua stack without creating MultiValue container.
This approach is a big optimization opportunity and already demonstrated great results.
For instance, obtaining `&T` for userdata methods are now work directly from stack value without copying to auxiliary stack.
2023-07-31 22:13:23 +01:00
Alex Orlenko
4daa631178
Set __type metatable field for Luau instead of __name.
...
Other Lua versions continue to use `__name` field.
Also make `MetaMethod` enum non-exhaustive (and add `Type` variant)
Closes #295
2023-07-26 21:43:26 +01:00
Alex Orlenko
128c357e07
Use __tostring if __name is not available when pretty printing userdata values
2023-07-11 21:36:02 +01:00
Alex Orlenko
541139b944
Change Lua ref types Debug print from Ref{index} to Ref{pointer}
...
The index is always uniq per instance, but pointer can exactly tell when
several values reference to the same Lua internal value.
2023-07-08 12:52:14 +01:00
Alex Orlenko
1f0e81c9a1
Add a dedicated type for Luau vector.
...
Refactor existing implementation and add 4-dimensional vectors support.
2023-06-20 13:30:42 +01:00
Alex Orlenko
b674d7906d
Include (known) userdata type to Value debug pretty-print
2023-05-28 01:12:42 +01:00
Alex Orlenko
4306e6e978
Add Value::to_string() method similar to luaL_tolstring.
...
It uses `__tostring` metamethod if set.
Closes #279
2023-05-27 01:29:08 +01:00
Alex Orlenko
d951cb503f
Add Value::NULL constant
2023-05-06 22:53:40 +01:00
Alex Orlenko
aaf0a5e44a
Remove usage of crate::ffi (clippy)
2023-04-14 00:36:31 +01:00
Alex Orlenko
cdbf04f50c
Add pretty-print to the Debug formatting to Value to Table.
...
This would allow dumping any Lua variable in human readable form.
2023-04-11 20:36:41 +01:00
Alex Orlenko
a0d37fd182
Rename error to cause in Error::BadArgument
2023-03-16 23:48:54 +00:00
Alex Orlenko
03787668fd
Improve error reporting when calling Rust functions from Lua.
...
In particular new error type `Error::BadArgument` added to help identify bad argument position or name (eg `self` for userdata).
2023-03-14 23:23:46 +00:00
Alex Orlenko
0cb7058476
Rename MultiValue cache to pool
2022-12-30 14:50:39 +00:00
Alex Orlenko
a13c188de3
Rename ToLua/ToLuaMulti -> IntoLua/IntoLuaMulti
2022-12-19 23:00:47 +00:00
Alex Orlenko
9b4e3a1598
Refactor LuaInner state
...
Add static_assertions to check for auto traits impl on compilation stage
Bump MSRV to 1.63 (required for `Ref::filter_map`)
2022-12-19 16:09:05 +00:00
Alex Orlenko
05eb20f9c6
Fix subtraction overflow when calculating index for MultiValue::get().
...
Return `None` instead of panic in debug mode.
Fixes #232
2022-12-15 21:10:31 +00:00
Alex Orlenko
fcd162f3eb
Replace Lua::ref_thread_exec
2022-10-22 23:39:49 +01:00
Alex Orlenko
f75af6d75f
Fix clippy warnings
2022-07-17 11:11:30 +01:00
Eric Long
553251761f
Add MultiValue::get & add clear error in Index
2022-07-01 01:59:40 +08:00
Eric Long
c20eb20a59
Implement utilities for MultiValue
2022-06-29 01:21:32 +08:00
Alex Orlenko
04ba93137c
Add Table::to_pointer() and String::to_pointer() functions
2022-06-27 14:58:48 +01:00
Alex Orlenko
799b4e9f0d
Make Variadic::new and MultiValue::new const
2022-05-28 21:13:49 +01:00
Alex Orlenko
bcf2cbea37
Add Value::to_pointer() function.
...
Closes #165 and #166 .
2022-05-18 13:15:08 +01:00
Alex Orlenko
ec1fa04085
Update docs
2022-03-25 00:43:54 +00:00
Alex Orlenko
3a9c8c2da2
Add Luau vector datatype support
2022-03-22 21:14:06 +00:00
Alex Orlenko
6dc127f4eb
Refactor ffi module
...
Initial Luau support work
2022-03-20 20:30:18 +00:00
Alex Orlenko
1b74c89509
More performance optimizations
2021-11-25 11:16:12 +00:00