mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
full implementation for nullable unwrapped
This commit is contained in:
parent
64f96c4182
commit
3151a08edb
3 changed files with 169 additions and 11 deletions
|
@ -44,6 +44,15 @@ impl<T> RocBox<T> {
|
|||
Self { contents }
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
/// The box must be unique in order to leak it safely
|
||||
pub unsafe fn leak(self) -> *mut T {
|
||||
let ptr = self.contents.as_ptr() as *mut T;
|
||||
core::mem::forget(self);
|
||||
ptr
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn alloc_alignment() -> usize {
|
||||
mem::align_of::<T>().max(mem::align_of::<Storage>())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue