pub unsafe fn read_bytes_into_pointer_while<F>(
        &self,
        pointer: Pointer,
        should_continue: F,
        include_last_byte: bool,
        into_pointer: *mut u8,
    ) where
        F: Fn(u8, usize) -> bool,
    {
        let heap = &self.heap_u8();
        let start_offset = pointer.offset as usize;
        let mut bytes_read = 0;
        loop {
            let offset = &JsValue::from_f64((start_offset + bytes_read) as f64);
            let byte = Reflect::get(heap, offset).unwrap().as_f64().unwrap() as u8;
            if should_continue(byte, bytes_read) {
                *into_pointer.offset(bytes_read as isize) = byte;
                bytes_read += 1;
                continue;
            }
            if include_last_byte {
                *into_pointer.offset(bytes_read as isize) = byte;
            }
            break;
        }
    }
/// Clones all bytes from the heap into the pointer provided while `should_continue` returns `true`.
/// Optionally include the last byte (i.e. to support peeking the final byte for nul-terminated strings).
/// Assumes the memory at the pointer is large enough to hold all bytes read (based on when `should_continue` terminates).
Clones all bytes from the heap into the pointer provided while `should_continue` returns `true`.
Optionally include the last byte .
Assumes the memory at the pointer is large enough to hold all bytes read (based on when `should_continue` terminates).
Clones all bytes from the heap into the pointer provided while ` should_continue ` returns ` true ` . Optionally include the last byte . Assumes the memory at the pointer is large enough to hold all bytes read ( based on when ` should_continue ` terminates ) .
pub unsafe fn read_bytes_into_pointer_while<F>(
        &self,
        pointer: Pointer,
        should_continue: F,
        include_last_byte: bool,
        into_pointer: *mut u8,
    ) where
        F: Fn(u8, usize) -> bool,
    {
        let heap = &self.heap_u8();
        let start_offset = pointer.offset as usize;
        let mut bytes_read = 0;
        loop {
            let offset = &JsValue::from_f64((start_offset + bytes_read) as f64);
            let byte = Reflect::get(heap, offset).unwrap().as_f64().unwrap() as u8;
            if should_continue(byte, bytes_read) {
                *into_pointer.offset(bytes_read as isize) = byte;
                bytes_read += 1;
                continue;
            }
            if include_last_byte {
                *into_pointer.offset(bytes_read as isize) = byte;
            }
            break;
        }
    }
pub unsafe fn read_bytes_into_pointer_while < F > ( & self , pointer : Pointer , should_continue : F , include_last_byte : bool , into_pointer : * mut u8 , ) where F : Fn ( u8 , usize ) -> bool , { let heap = & self . heap_u8 ( ) ; let start_offset = pointer . offset as usize ; let mut bytes_read = 0 ; loop { let offset = & JsValue :: from_f64 ( ( start_offset + bytes_read ) as f64 ) ; let byte = Reflect :: get ( heap , offset ) . unwrap ( ) . as_f64 ( ) . unwrap ( ) as u8 ; if should_continue ( byte , bytes_read ) { * into_pointer . offset ( bytes_read as isize ) = byte ; bytes_read += 1 ; continue ; } if include_last_byte { * into_pointer . offset ( bytes_read as isize ) = byte ; } break ; } }
Clones all bytes from the heap into the pointer provided while `should_continue` returns `true`.
Clones all bytes from the heap into the pointer provided while ` should_continue ` returns ` true ` .
&self
pointer
Pointer
should_continue
F
include_last_byte
bool
into_pointer
*mut u8
&self
pointer
Pointer
should_continue
F
include_last_byte
bool
into_pointer
*mut u8