pub(crate) unsafe fn dup(&self) -> Ptr<T, A> {
        let src = self.as_ref();
        let dst = A::alloc_for_value(src);
        let trg = A::off_unchecked(dst);
        let len = std::alloc::Layout::for_value(src).size();
        std::ptr::copy_nonoverlapping(
            src as *const T as *const u8,
            dst as *mut T as *mut u8,
            len,
        );
        Ptr::from_off_unchecked(trg)
    }
/// Creates a new copy of data and returns a `Ptr` pointer
///
/// # Safety
///
/// The compiler would not drop the copied data. Developer has the
/// responsibility of deallocating inner value. Also, it does not clone the
/// inner value. Instead, it just copies the memory.
Creates a new copy of data and returns a `Ptr` pointer
Creates a new copy of data and returns a ` Ptr ` pointer
pub(crate) unsafe fn dup(&self) -> Ptr<T, A> {
        let src = self.as_ref();
        let dst = A::alloc_for_value(src);
        let trg = A::off_unchecked(dst);
        let len = std::alloc::Layout::for_value(src).size();
        std::ptr::copy_nonoverlapping(
            src as *const T as *const u8,
            dst as *mut T as *mut u8,
            len,
        );
        Ptr::from_off_unchecked(trg)
    }
pub ( crate ) unsafe fn dup ( & self ) -> Ptr < T , A > { let src = self . as_ref ( ) ; let dst = A :: alloc_for_value ( src ) ; let trg = A :: off_unchecked ( dst ) ; let len = std :: alloc :: Layout :: for_value ( src ) . size ( ) ; std :: ptr :: copy_nonoverlapping ( src as * const T as * const u8 , dst as * mut T as * mut u8 , len , ) ; Ptr :: from_off_unchecked ( trg ) }
Creates a new copy of data and returns a `Ptr` pointer
Creates a new copy of data and returns a ` Ptr ` pointer
&self
safety
The compiler would not drop the copied data. Developer has the
responsibility of deallocating inner value. Also, it does not clone the
inner value. Instead, it just copies the memory.
The compiler would not drop the copied data . Developer has the responsibility of deallocating inner value . Also it does not clone the inner value . Instead it just copies the memory .