MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / buildIntoWithVersion

Function buildIntoWithVersion

packages/core/src/drawlist/builderBase.ts:457–484  ·  view source on GitHub ↗
(version: number, dst: Uint8Array)

Source from the content-addressed store, hash-verified

455 }
456
457 protected buildIntoWithVersion(version: number, dst: Uint8Array): DrawlistBuildResult {
458 if (this.error) {
459 return { ok: false, error: this.error };
460 }
461
462 if (!(dst instanceof Uint8Array)) {
463 return {
464 ok: false,
465 error: { code: "ZRDL_BAD_PARAMS", detail: "buildInto: dst must be a Uint8Array" },
466 };
467 }
468
469 const prepared = this.prepareBuildLayout();
470 if ("ok" in prepared) return prepared;
471 const layout = prepared;
472
473 if (dst.byteLength < layout.totalSize) {
474 return {
475 ok: false,
476 error: {
477 code: "ZRDL_TOO_LARGE",
478 detail: `buildInto: dst is too small (required=${layout.totalSize}, got=${dst.byteLength})`,
479 },
480 };
481 }
482
483 return this.writeBuildInto(version, layout, dst);
484 }
485
486 private prepareBuildLayout(): Layout | DrawlistBuildResult {
487 if ((this.cmdLen & 3) !== 0) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected