Type alias AllocationStrategy

AllocationStrategy: {
    allocator: ((old) => ArrayBuffer);
    shouldBeTrimmed: ((used) => ((len) => boolean));
}

A strategy for allocation of ArrayBuffer on serialization.

Type declaration

  • allocator: ((old) => ArrayBuffer)
      • (old): ArrayBuffer
      • Allocates/reallocates a new ArrayBuffer.

        Parameters

        • old: Option<[ArrayBuffer, number]>

          When it is Some, old buffer and required minimal size on reallocation.

        Returns ArrayBuffer

        The new ArrayBuffer.

  • shouldBeTrimmed: ((used) => ((len) => boolean))
      • (used): ((len) => boolean)
      • Decides that the current ArrayBuffer should be trimmed.

        Parameters

        • used: number

          The used length for serialization in the buffer.

        Returns ((len) => boolean)

        Whether the buffer should be trimmed.

          • (len): boolean
          • Parameters

            • len: number

            Returns boolean

Generated using TypeDoc