~/bend-docscommunity

decode_data.bend checks

raw source on the hub · import bendvy-ecs-core@0.1.0.2/decode_data.bend as Decode_data

3 imports
import Base
import entity_key.bend as Key
import ./decode_utf16.bend as Utf16

Types

type Raw source · line 6 · raw

Data

Raw is a typed Data description. Arbitrary affine payload ownership is a separate explicit receipt; this validator never invents an inverse Raw -> C.

type Field source · line 19 · raw

Data

type Codec source · line 21 · raw

Data

type NamedCodec source · line 33 · raw

Data

type Error source · line 35 · raw

Data

type Checked source · line 38 · raw

Data

type Owned source · line 41 · raw

@Owner:Type -> Type

type Receipt source · line 43 · raw

@Owner:Type -> Type

type Work source · line 53 · raw

Data

type Step source · line 55 · raw

Data

type Numeric source · line 60 · raw

Data

Exact SameValueZero numeric equality uses a 53-bit mantissa pair, avoiding impossible runtime Nat immediates above Bend's 2^48-1 emitter limit.

Definitions

def field_choose source · line 45 · raw

@equal:Bool -> @value:Raw -> @next:(@_:Unit -> Raw) -> Raw

def field source · line 49 · raw

@+name:String -> @fields:List<&2, Field> -> Raw

def normalize_checked source · line 65 · raw

@fuel:Nat -> @+negative:Bool -> @+high:U32 -> @+low:U32 -> @+exponent:U32 -> @zero:Bool -> @even:Bool -> Numeric

def normalize source · line 71 · raw

@fuel:Nat -> @+negative:Bool -> @+high:U32 -> @+low:U32 -> @+exponent:U32 -> Numeric

def numeric_special source · line 73 · raw

@negative:Bool -> @infinite:Bool -> Numeric

def float_parts source · line 77 · raw

@+bits:U32 -> @+exponent:U32 -> @+fraction:U32 -> @special:Bool -> @zero:Bool -> Numeric

def float_numeric source · line 82 · raw

@+bits:U32 -> Numeric

def binary_parts source · line 84 · raw

@+negative:Bool -> @+exponent:U32 -> @+high:U32 -> @+low:U32 -> @special:Bool -> @zero:Bool -> Numeric

def binary_numeric source · line 89 · raw

@+high:U32 -> @+low:U32 -> Numeric

def numeric source · line 91 · raw

@raw:Raw -> Numeric

def same_bool source · line 98 · raw

@a:Bool -> @b:Bool -> Bool

def same_numeric source · line 103 · raw

@a:Numeric -> @b:Numeric -> Bool

def equal source · line 109 · raw

@+a:Raw -> @+b:Raw -> Bool

def alternatives source · line 118 · raw

@values:List<&2, Raw> -> @+raw:Raw -> Bool

def choose_checked source · line 122 · raw

@valid:Bool -> @+path:String -> @+expected:String -> @raw:Raw -> @rest:List<&2, Work> -> Step

def array_work source · line 126 · raw

@+codec:Codec -> @items:List<&2, Raw> -> @+path:String -> @+index:U32 -> @rest:List<&2, Work> -> List<&2, Work>

def struct_work source · line 130 · raw

@fields:List<&2, NamedCodec> -> @+values:List<&2, Field> -> @+path:String -> @rest:List<&2, Work> -> List<&2, Work>

def binary64_exponent source · line 134 · raw

@high:U32 -> U32

def binary_integer_normal source · line 136 · raw

@result:Numeric -> Bool

def binary_integer_checked source · line 140 · raw

@result:Numeric -> @small:Bool -> Bool

def binary_integer source · line 142 · raw

@+high:U32 -> @+low:U32 -> Bool

def expand source · line 144 · raw

@codec:Codec -> @+raw:Raw -> @+path:String -> @rest:List<&2, Work> -> Step

def validate source · line 172 · raw

@fuel:Nat -> @step:Step -> @+original:Raw -> Checked

def canonical_array_join source · line 190 · raw

@head:Raw -> @tail:Raw -> Raw

def canonical_struct_join source · line 194 · raw

@name:String -> @head:Raw -> @tail:Raw -> Raw

def canonical source · line 198 · raw

@fuel:Nat -> @codec:Codec -> @raw:Raw -> Raw

Templates

template owned source · line 178 · raw

@-Owner:Type -> @fuel:Nat -> @codec:Codec -> @input:Owned<Owner> -> Receipt<Owner>

template associated source · line 182 · raw

@-Owner:Type -> @fuel:Nat -> @codec:Codec -> @observed:Pair(Owner, Raw) -> Receipt<Owner>

template validate_owner source · line 187 · raw

@-Owner:Type -> @-project:(@_:Owner -> Pair(Owner, Raw)) -> @fuel:Nat -> @codec:Codec -> @owner:Owner -> Receipt<Owner>

The closed schema projection must inspect the actual owner. It returns that owner rather than caller-supplied unrelated metadata. Its semantics are trusted.

template normalized source · line 208 · raw

@-Owner:Type -> @+fuel:Nat -> @+codec:Codec -> @result:Receipt<Owner> -> Receipt<Owner>

template decode_owner source · line 212 · raw

@-Owner:Type -> @-project:(@_:Owner -> Pair(Owner, Raw)) -> @+fuel:Nat -> @+codec:Codec -> @owner:Owner -> Receipt<Owner>