From 584beed8e62d0dab381fd538fabcccb86b5b4b7d Mon Sep 17 00:00:00 2001 From: Katherine Kiefer Date: Fri, 22 Sep 2023 23:46:16 +1000 Subject: [PATCH] don't to_vec it --- crates/byondapi-rs/src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/byondapi-rs/src/lib.rs b/crates/byondapi-rs/src/lib.rs index 3b630c6..7c6868f 100644 --- a/crates/byondapi-rs/src/lib.rs +++ b/crates/byondapi-rs/src/lib.rs @@ -15,8 +15,11 @@ use crate::value::ByondValue; /// # Safety /// Don't pass in a null argv pointer please god /// Just give this what BYOND gives you and pray for the best -pub unsafe fn parse_args(argc: byondapi_sys::u4c, argv: *mut ByondValue) -> Vec { - unsafe { std::slice::from_raw_parts_mut(argv, argc as usize).to_vec() } +pub unsafe fn parse_args( + argc: byondapi_sys::u4c, + argv: *mut ByondValue, +) -> &'static mut [ByondValue] { + unsafe { std::slice::from_raw_parts_mut(argv, argc as usize) } } /// Re-export of byondapi_sys for all low level things you may run into.