Array
NAME
NativeHelpers::Array - helper subroutines for native arrays
DESCRIPTION
This provides a number of exported subroutines that may be useful for working with native CArrays. The subroutines aren't particularly complicated but it saves having to have the same code in multiple modules.
SUBROUTINES
sub copy-to-carray
sub copy-to-carray(@items, Mu $type) returns CArray is export
Copy the array to the new CArray typed as per $type
. If the supplied type
is not a valid native type there will be an exception. If the elements of the
array are out of range for the type then the values in the CArray may be
truncated.
sub copy-to-array
sub copy-to-array(CArray $carray, Int $items) returns Array is export
Copy the supplied CArray of the given length to a new Array.
sub copy-buf-to-carray
sub copy-buf-to-carray(Buf $buf) returns CArray[uint8] is export
Copy the elements of the supplied Buf to a CArray[uint8].
sub copy-carray-to-buf(
sub copy-carray-to-buf(CArray $array, Int $no-elems) returns Buf is export
Copy the CArray[uint8] of the specified number of elements to a Buf