/// Allocates the given number of bytes in Pdfium's WASM memory heap, returning a pointer
/// to the allocation address.
Allocates the given number of bytes in Pdfium's WASM memory heap, returning a pointer
to the allocation address.
Allocates the given number of bytes in Pdfium ' s WASM memory heap returning a pointer to the allocation address .
fn malloc(&self, len: usize) -> usize {
        match self
            .malloc_js_fn
            .as_ref()
            .unwrap()
            .call1(&JsValue::null(), &JsValue::from_f64(len as f64))
        {
            Ok(result) => match result.as_f64() {
                Some(result) => result as usize,
                None => {
                    log::error!("pdfium-render::PdfiumRenderWasmState::malloc(): return value from Module._malloc() is not a Javascript number");
                    panic!();
                }
            },
            Err(err) => {
                log::error!(
                    "pdfium-render::PdfiumRenderWasmState::malloc(): call to Module._malloc() failed for allocation length {}: {:#?}",
                    len,
                    err
                );
                panic!();
            }
        }
    }
fn malloc ( & self , len : usize ) -> usize { match self . malloc_js_fn . as_ref ( ) . unwrap ( ) . call1 ( & JsValue :: null ( ) , & JsValue :: from_f64 ( len as f64 ) ) { Ok ( result ) => match result . as_f64 ( ) { Some ( result ) => result as usize , None => { log :: error ! ( " " ) ; panic ! ( ) ; } } , Err ( err ) => { log :: error ! ( " " len err ) ; panic ! ( ) ; } } }
Allocates the given number of bytes in Pdfium's WASM memory heap, returning a pointer
to the allocation address.
Allocates the given number of bytes in Pdfium ' s WASM memory heap returning a pointer to the allocation address .
&self
len
usize