rustVec static method

CustomLayout rustVec(
  1. Layout elementLayout, {
  2. String? property,
})

factory for Rust vectors

Implementation

static CustomLayout rustVec(Layout elementLayout, {String? property}) {
  final length = u32('length');
  final padding = u32('paddingLength');
  final layout = struct([
    length,
    padding,
    seq(elementLayout, offset(length, -8), property: 'values'),
  ]);
  return CustomLayout<Map<String, dynamic>, dynamic>(
    layout: layout,
    encoder: (data) => {"values": data},
    decoder: (data) => data["values"],
    property: property,
  );
}