rawbody

package
v0.2026321.1237 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 3 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package rawbody is the ONE crossing between authored shapes and the IR's opaque bodies.

DESIGN.md §3.1 makes each plugin own its candy body, and I1/D-SCH-7 says the contract carries bytes rather than importing those shapes. That leaves exactly two operations at every seam — write the bytes, and read them back — and they live HERE rather than once per consumer because sdk's two consumers (`loaderkit` and `deploykit`) do not import each other: without a shared package each would carry its own copy, and the copies drift. That is not hypothetical: the first two copies of this crossing disagreed within one PR — one guarded on `!= nil` and one on `len() > 0`, and the `!= nil` one answered the wrong question for a slice.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode[T any](body spec.RawBody, what string) []T

Decode reads a body that holds a LIST into typed entries. Empty bytes mean the candy declared nothing and yield nil; bytes that do not decode panic, because the producer marshals a typed value and anything else came from somewhere else.

func DecodeOne

func DecodeOne[T any](body spec.RawBody, what string) *T

DecodeOne reads a body that holds a SINGLE object.

func Encode

func Encode[T any](v T, what string) spec.RawBody

Encode marshals an authored value into an IR body.

A typed value always marshals, so a failure is an invariant violation rather than a recoverable condition: silently returning an empty body would reach the consumer as "the candy declared nothing" — a hook that never runs, a stage that copies no files — with nothing saying why. It panics at the point the invariant breaks.

func HasPtr

func HasPtr[T any](v *T) bool

HasPtr reports whether a POINTER field should produce a body. A pointer's only "absent" is nil; `len()` does not apply. Two functions rather than one because `[]T` does not accept a `*T`.

func HasSlice

func HasSlice[T any](v []T) bool

HasSlice reports whether a SLICE field should produce a body at all.

`len() > 0`, NEVER `!= nil`: an empty non-nil slice marshals to "[]" — two non-empty bytes — so a `len(body) > 0` predicate downstream would answer true for a value that declares nothing. The guard has to ask the same question the predicate asks.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL