gluon/src/utils/general/cast_boxed_array.rs

12 lines
289 B
Rust

pub fn cast_box<'a>(boxed: Box<str>) -> &'a str {
unsafe { &*Box::into_raw(boxed) }
}
#[allow(clippy::boxed_local)]
pub fn cast_boxed<'a>(boxed_array: Box<[Box<str>]>) -> Vec<&'a str> {
boxed_array
.iter()
.map(|arg| cast_box(arg.to_owned()))
.collect()
}