Stephen Chung
30ff208104
Improve reify! syntax.
2022-12-09 16:41:01 +08:00
Stephen Chung
de0707f64f
Use macro auto_restore!.
2022-12-04 14:06:54 +08:00
Stephen Chung
28640a6fe4
code cleanup.
2022-12-01 14:24:08 +08:00
Stephen Chung
29a397b216
Refine #[must_use]
2022-11-28 16:36:40 +08:00
Stephen Chung
6600862c22
Satisfy clippy.
2022-11-25 09:46:13 +08:00
Stephen Chung
46514bbc85
Fix builds.
2022-11-23 18:02:10 +08:00
Stephen Chung
3e7408511e
Satisfy more clippy.
2022-11-23 16:14:11 +08:00
Stephen Chung
d151c87687
Change call_fn_raw to call_fn_with_options.
2022-11-21 23:42:29 +08:00
Stephen Chung
a1d42b826a
Simplify Dynamic::as_XXX calls.
2022-11-09 20:18:11 +08:00
Stephen Chung
ce046422f0
Add Dynamic::is_XXX API.
2022-11-09 12:44:57 +08:00
Stephen Chung
ad018aaae3
Move FloatWrapper into types.
2022-11-08 23:17:31 +08:00
Stephen Chung
8f128f37f0
Add Dynamic::NULL to simplify this pointer binding.
2022-11-08 16:16:42 +08:00
Stephen Chung
3c2e031883
Use variable interpolation for println!.
2022-10-27 13:38:21 +08:00
Stephen Chung
45f0fdcbe0
no_std = no_time.
2022-10-15 15:11:51 +08:00
Stephen Chung
a6a570131a
Add no_time.
2022-10-15 12:37:42 +08:00
Stephen Chung
6c777e68d3
Refine inlining.
2022-09-28 12:06:22 +08:00
Stephen Chung
25476d1cea
Mark debug functions cold.
2022-09-27 08:52:39 +08:00
Stephen Chung
3a3653f42a
Refactor.
2022-09-26 23:35:37 +08:00
Stephen Chung
335d12e182
Move Variant into separate file.
2022-09-26 12:19:45 +08:00
Stephen Chung
b56a9c22f3
Refactor.
2022-09-25 12:24:03 +08:00
Stephen Chung
c727b529f5
Minor refactors.
2022-09-15 08:55:07 +08:00
Stephen Chung
80772df4f4
Shut up clippy.
2022-08-29 14:27:05 +08:00
Stephen Chung
bf5d6ab35a
Shut up clippy.
2022-08-27 16:26:41 +08:00
Stephen Chung
a9b6e8b98c
Fix builds.
2022-08-18 21:16:42 +08:00
Stephen Chung
5f2262214d
Add docs.
2022-08-14 18:16:35 +08:00
Stephen Chung
3cb66b7e23
Fix bug.
2022-08-12 16:44:13 +08:00
Stephen Chung
5ba9b3bd1c
Optimize Dynamic::is.
2022-08-12 12:48:35 +08:00
Stephen Chung
255af006ee
Fix doc comments.
2022-08-10 12:48:37 +08:00
Stephen Chung
2f948a784c
Clean up more clippy.
2022-07-27 18:04:59 +08:00
Stephen Chung
39dee556c4
Clean up clippy.
2022-07-27 16:04:24 +08:00
quake
299777f1c9
chore: clippy fix needless_borrow
2022-07-20 21:16:35 +09:00
quake
4033543309
chore: remove clippy redundant_allocation since it has been resolved in clippy#7592
2022-07-20 17:05:05 +09:00
Stephen Chung
d9875ff81c
Fix sync feature.
2022-06-26 17:14:10 +08:00
Stephen Chung
335957fbc2
Enable modifying constant shared values.
2022-06-26 17:04:08 +08:00
Stephen Chung
7068775f19
Use locked_read.
2022-06-26 14:10:09 +08:00
Stephen Chung
addb579f30
Streamline Dynamic.
2022-06-17 23:36:18 +08:00
Stephen Chung
dcaac20eb9
Strict mode in functions check for static modules.
2022-06-09 17:59:28 +08:00
Stephen Chung
2a57bd9d25
Mark some types as non_exhaustive.
2022-05-03 21:55:08 +08:00
Stephen Chung
63359f3f81
Unused parameters naming.
2022-04-11 16:29:16 +08:00
Stephen Chung
5caf20d26b
Search for global variables in global modules.
2022-03-27 21:49:34 +08:00
Stephen Chung
fefa633cf0
Add type alias support for plugin modules.
2022-03-19 09:43:18 +08:00
Stephen Chung
14e23ed74c
Fix sync build.
2022-03-03 13:14:35 +08:00
Stephen Chung
0e9a16e437
Add checks for is_empty.
2022-03-03 13:02:57 +08:00
Stephen Chung
83755bf936
Refine doc comments.
2022-03-01 15:34:15 +08:00
Stephen Chung
73f10b8adc
Minor housekeeping.
2022-02-24 10:36:20 +08:00
Stephen Chung
97a8fd3d5b
Improve reify syntax.
2022-02-08 09:25:53 +08:00
Stephen Chung
f8cee0fe4e
Simplify using ..
2022-02-08 09:02:15 +08:00
Stephen Chung
bd9519e96b
Remove reify_dynamic.
2022-02-07 12:02:00 +08:00
Stephen Chung
becbfa8930
Fix errors.
2022-02-06 23:02:59 +08:00
Nathan Kent
86d86a85e4
Remove unsound casting functions
...
The casting functions in `unsafe.rs` were unsound (i.e., they allowed
safe code to cause undefined behavior). While they did appear to be used
in a way that wouldn't cause UB the fact that there exists unsound
functions is unsettling.
This commit removes those functions and replaces it with a macro that
performs the same reification - the difference is that the macro call
will also include the checks which are required to prevent UB. A macro
was chosen instead of a function for two reasons:
1. A macro can keep the same code generation whereas a function would
require going through an `Option` which has negative impacts on code
generation (niche values cause poor DCE).
2. There exist other `unsafe` code blocks in the crate and an attempt to
make Rhai 100% safe is completely out-of-scope for this merge
request, so we may as well use `unsafe` in the macro.
Regarding (2) above, I may come back at a later date with a 100% safe
`reify` function but only once the other `unsafe` blocks are removed.
For posterity, said function would look something like:
```rust
fn reify<A: Any, C>(value: A) -> Option<C> {
let mut v = Some(value);
let v: &mut dyn Any = &mut v;
v.downcast_mut::<Option<C>>().map(Option::take)
}
```
2022-02-05 16:29:05 -08:00