diff options
author | Alex Orlenko <zxteam@protonmail.com> | 2022-03-26 00:30:57 +0000 |
---|---|---|
committer | Alex Orlenko <zxteam@protonmail.com> | 2022-03-26 00:30:57 +0000 |
commit | f75b7b7879e1c3c9d12b02a42903d04eb26e8635 (patch) | |
tree | 285e299445563b0516f485cbf19a1667bea59a0b /src | |
parent | de1cfa070f2c83bf8357f2cb246885f5619dc1b5 (diff) | |
download | mlua-f75b7b7879e1c3c9d12b02a42903d04eb26e8635.zip |
Remove Lua::into_static/from_static
Diffstat (limited to 'src')
-rw-r--r-- | src/lua.rs | 26 |
1 files changed, 0 insertions, 26 deletions
@@ -696,32 +696,6 @@ impl Lua { Ok(()) } - /// Consumes and leaks `Lua` object, returning a static reference `&'static Lua`. - /// - /// This function is useful when the `Lua` object is supposed to live for the remainder - /// of the program's life. - /// In particular in asynchronous context this will allow to spawn Lua tasks to execute - /// in background. - /// - /// Dropping the returned reference will cause a memory leak. If this is not acceptable, - /// the reference should first be wrapped with the [`Lua::from_static`] function producing a `Lua`. - /// This `Lua` object can then be dropped which will properly release the allocated memory. - /// - /// [`Lua::from_static`]: #method.from_static - #[doc(hidden)] - pub fn into_static(self) -> &'static Self { - Box::leak(Box::new(self)) - } - - /// Constructs a `Lua` from a static reference to it. - /// - /// # Safety - /// This function is unsafe because improper use may lead to memory problems or undefined behavior. - #[doc(hidden)] - pub unsafe fn from_static(lua: &'static Lua) -> Self { - *Box::from_raw(lua as *const Lua as *mut Lua) - } - // Executes module entrypoint function, which returns only one Value. // The returned value then pushed onto the stack. #[doc(hidden)] |