fn copy_struct_from_pdfium<T>(
        &self,
        pdfium_buffer_ptr: usize,
        pdfium_buffer_len_bytes: usize,
        local_buffer_ptr: *mut T,
    ) {
        if pdfium_buffer_len_bytes > 0 {
            log::debug!(
                "pdfium-render::PdfiumLibraryBindings::copy_struct_from_pdfium(): copying {} bytes from Pdfium's WASM heap into local buffer at offset {}",
                pdfium_buffer_len_bytes,
                local_buffer_ptr as usize
            );

            unsafe {
                local_buffer_ptr.copy_from(
                    self.copy_bytes_from_pdfium(pdfium_buffer_ptr, pdfium_buffer_len_bytes)
                        .as_ptr() as *mut T,
                    // Pdfium's buffer length is expressed in bytes, but buffer.copy_from()
                    // expects the _count_ of pointer-sized objects to copy, i.e. the number of Ts,
                    // which may or may not be the same as the number of bytes depending on
                    // the size_of::<T>().
                    pdfium_buffer_len_bytes / size_of::<T>(),
                );
            }
        }
    }
/// Copies bytes from the given pointer address in Pdfium's memory heap into our memory
/// heap, using the given address to a pointer in our memory heap.
///
/// WASM modules are isolated from one another and cannot directly share memory. We must
/// therefore copy buffers from Pdfium's memory heap across into our own, and vice versa.
Copies bytes from the given pointer address in Pdfium's memory heap into our memory
heap, using the given address to a pointer in our memory heap.

WASM modules are isolated from one another and cannot directly share memory. We must
therefore copy buffers from Pdfium's memory heap across into our own, and vice versa.
Copies bytes from the given pointer address in Pdfium ' s memory heap into our memory heap using the given address to a pointer in our memory heap . WASM modules are isolated from one another and cannot directly share memory . We must therefore copy buffers from Pdfium ' s memory heap across into our own and vice versa .
fn copy_struct_from_pdfium<T>(
        &self,
        pdfium_buffer_ptr: usize,
        pdfium_buffer_len_bytes: usize,
        local_buffer_ptr: *mut T,
    ) {
        if pdfium_buffer_len_bytes > 0 {
            log::debug!(
                "pdfium-render::PdfiumLibraryBindings::copy_struct_from_pdfium(): copying {} bytes from Pdfium's WASM heap into local buffer at offset {}",
                pdfium_buffer_len_bytes,
                local_buffer_ptr as usize
            );
            unsafe {
                local_buffer_ptr.copy_from(
                    self.copy_bytes_from_pdfium(pdfium_buffer_ptr, pdfium_buffer_len_bytes)
                        .as_ptr() as *mut T,
                    // Pdfium's buffer length is expressed in bytes, but buffer.copy_from()
                    // expects the _count_ of pointer-sized objects to copy, i.e. the number of Ts,
                    // which may or may not be the same as the number of bytes depending on
                    // the size_of::<T>().
                    pdfium_buffer_len_bytes / size_of::<T>(),
                );
            }
        }
    }
fn copy_struct_from_pdfium < T > ( & self , pdfium_buffer_ptr : usize , pdfium_buffer_len_bytes : usize , local_buffer_ptr : * mut T , ) { if pdfium_buffer_len_bytes > 0 { log :: debug ! ( " " pdfium_buffer_len_bytes local_buffer_ptr as usize ) ; unsafe { local_buffer_ptr . copy_from ( self . copy_bytes_from_pdfium ( pdfium_buffer_ptr , pdfium_buffer_len_bytes ) . as_ptr ( ) as * mut T , // Pdfium's buffer length is expressed in bytes, but buffer.copy_from() // expects the _count_ of pointer-sized objects to copy, i.e. the number of Ts, // which may or may not be the same as the number of bytes depending on // the size_of::<T>(). pdfium_buffer_len_bytes / size_of :: < T > ( ) , ) ; } } }
Copies bytes from the given pointer address in Pdfium's memory heap into our memory
heap, using the given address to a pointer in our memory heap.
Copies bytes from the given pointer address in Pdfium ' s memory heap into our memory heap using the given address to a pointer in our memory heap .
&self
pdfium_buffer_ptr
usize
pdfium_buffer_len_bytes
usize
local_buffer_ptr
*mut T
&self
pdfium_buffer_ptr
usize
pdfium_buffer_len_bytes
usize
local_buffer_ptr
*mut T