tidying up

This commit is contained in:
2023-02-28 16:22:53 +01:00
parent 2419592f22
commit 19031035a1
3 changed files with 43 additions and 33 deletions

View File

@ -63,3 +63,13 @@ impl<'a> Readline<'a> {
buffer
}
}
/**
* I know that this isn't considered true rusty code, but the places it's used in is
* safe. For this I'll leave the funciton as unsafe, so to better see it's uses.
* This solution makes the uses BLAZINGLY FAST which moreover is the most rusty you can get.
*/
pub unsafe fn get_mut_ref<T>(reference: &T) -> &mut T {
let ptr = reference as *const T as *mut T;
&mut *ptr
}