Copy method

P Copy(
  1. S src,
  2. int length, {
  3. String? key,
})
inherited

Copies length elements from src into a slot and returns the pointer.

Uses asView for the bulk copy, which avoids an element-by-element loop. key defaults to 'struct'.

Implementation

P Copy(S src, int length, {String? key}) {
  final p = At(slotKey(key), length);
  asView(pointerToSource(p), length).setAll(0, asView(src, length));
  return p;
}