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 = padding(u32(property: "length"), propery: "length");

  final paddingLayout = padding(u32(), propery: "padding_length");
  final layout = struct([
    length,
    paddingLayout,
    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,
  );
}