MCPcopy Create free account
hub / github.com/Effect-TS/effect / encodeStructField

Function encodeStructField

packages/effect/src/encoding/SchemaBinary.ts:3483–3494  ·  view source on GitHub ↗
(ctx: EncodeContext, field: Field, value: unknown, w: Writer)

Source from the content-addressed store, hash-verified

3481}
3482
3483function encodeStructField(ctx: EncodeContext, field: Field, value: unknown, w: Writer) {
3484 const wire = valueWireCode(field.layout, value, ctx.options)
3485 const kind = wire % FIELD_WIRE_FACTOR
3486 if (kind === FIELD_WIRE_SIZED) {
3487 const mark = w.idAndMark(field.tagBytes)
3488 encodeValue(ctx, field.layout, value, w)
3489 w.endSized(mark)
3490 return
3491 }
3492 w.uvarint(field.id * FIELD_WIRE_FACTOR + kind)
3493 encodeWirePayload(ctx, field.layout, value, wire, w)
3494}
3495
3496function runPresenceMask(plan: RunPlan, obj: Record<string, unknown>): number | undefined {
3497 const byName = plan.byName

Callers 1

encodeStructFieldsFunction · 0.85

Calls 6

valueWireCodeFunction · 0.85
encodeWirePayloadFunction · 0.85
idAndMarkMethod · 0.80
endSizedMethod · 0.80
encodeValueFunction · 0.70
uvarintMethod · 0.45

Tested by

no test coverage detected