Sign in

    jtenner/starshine/binary does not have a README file

    Decode

    pub trait Decode {
    fn decode(Bytes, Int) -> Result[(Self, Int), BinaryDecodeError]
    }

    impl Decode for Bool
    impl Decode for Option[T]
    impl Decode for Bytes
    impl Decode for BlockType
    impl Decode for CastOp
    impl Decode for Catch
    impl Decode for CodeSec
    impl Decode for CompType
    impl Decode for CustomSec
    impl Decode for Data
    impl Decode for DataIdx
    impl Decode for DataSec
    impl Decode for Elem
    impl Decode for ElemIdx
    impl Decode for ElemSec
    impl Decode for Export
    impl Decode for ExportSec
    impl Decode for Expr
    impl Decode for ExternIdx
    impl Decode for F32
    impl Decode for F64
    impl Decode for FieldType
    impl Decode for Func
    impl Decode for FuncIdx
    impl Decode for FuncSec
    impl Decode for Global
    impl Decode for GlobalIdx
    impl Decode for GlobalSec
    impl Decode for HeapType
    impl Decode for I32
    impl Decode for I64
    impl Decode for Import
    impl Decode for ImportSec
    impl Decode for LabelIdx
    impl Decode for LaneIdx
    impl Decode for Limits
    impl Decode for LocalIdx
    impl Decode for LocalRun
    impl Decode for Locals
    impl Decode for MemArg
    impl Decode for MemIdx
    impl Decode for MemSec
    impl Decode for MemType
    impl Decode for Module
    impl Decode for Mut
    impl Decode for Name
    impl Decode for NameAssoc
    impl Decode for NameMap
    impl Decode for NameSec
    impl Decode for NumType
    impl Decode for PackType
    impl Decode for RecType
    impl Decode for RefType
    impl Decode for S33
    impl Decode for StartSec
    impl Decode for SubType
    impl Decode for Table
    impl Decode for TableIdx
    impl Decode for TableSec
    impl Decode for TableType
    impl Decode for TagIdx
    impl Decode for TagSec
    impl Decode for TagType
    impl Decode for TypeIdx
    impl Decode for TypeSec
    impl Decode for U32
    impl Decode for U64
    impl Decode for ValType
    impl Decode for CodeSite
    impl Decode for FactValue
    impl Decode for IntWidth
    impl Decode for KnownBits
    impl Decode for LoopFacts
    impl Decode for TypeFacts
    impl Decode for TypeView
    impl Decode for V128Bits
    impl Decode for ValueRef
    impl Decode for ValueSite
    impl Decode for WorldMode
    impl Decode for Array[T]
    impl Decode for List[T]

    Encode

    pub trait Encode {
    fn encode(Self,
    Buffer
    ) -> Result[Unit, BinaryEncodeError]
    }

    impl Encode for Bool
    impl Encode for Option[T]
    impl Encode for Bytes
    impl Encode for Array[T]

    BinaryDecodeError

    pub suberror BinaryDecodeError {
    IndexOutOfBounds
    InvalidNumTypeByte
    InvalidAbstractHeapType
    InvalidValType
    InvalidCompType
    UnexpectedEofDecodingMut
    InvalidMutByte
    InvalidStorageType
    InvalidPackedType
    InvalidUnsignedLebBitWidth
    UnexpectedEofInUnsignedLeb
    UnsignedLebTooManyBytes
    UnsignedLebOutOfRangeForBitWidth
    UnsignedLebTerminalHasNonZeroUnusedBits
    UnreachableDecodeState
    InvalidSignedLebBitWidth
    UnexpectedEofInSignedLeb
    SignedLebTooManyBytes
    SignedLebOutOfRangeForBitWidth
    SignedLebPositiveTerminalHasNonZeroUnusedBits
    SignedLebTerminalHasWrongSignExtensionBits
    InvalidS33Range
    InvalidBoolByte
    InvalidLaneIndex
    NegativeNameLength
    InvalidUtf8Name
    InvalidSectionHeader
    SectionPayloadLengthOutOfRange
    InvalidSectionPayloadTrailingBytes
    DuplicateNameSection
    DuplicateCompilerFactsSection
    InvalidCompilerFactsEnumTag
    InvalidCompilerFactsOptionTag
    TruncatedCompilerFactsPayload
    CompilerFactsTrailingBytes
    UnsupportedCompilerFactsVersion
    InvalidNameSubsectionId
    InvalidNameSubsectionOrder
    InvalidNameMapOrder
    InvalidMagicHeader
    InvalidModule
    InvalidElemHeader
    InvalidDataHeader
    CustomSectionPayloadLengthOutOfRange
    InvalidLimits
    InvalidTagType
    InvalidExternTypeHeader
    InvalidBlockType
    InvalidExternIndex
    InvalidOffset
    InvalidCatch
    InvalidCastOp
    InvalidMemArg
    InvalidStringRefSection
    InvalidStringLiteralIndex
    InvalidInstruction
    InvalidAtomicFenceImmediate
    InvalidAtomicInstruction
    InstructionNestingLimitExceeded
    } derive(Eq,
    Debug
    )

    BinaryEncodeError

    pub suberror BinaryEncodeError {
    CannotEncodeRecursiveIndexHeapType
    CannotEncodeDefTypeHeapType
    CannotEncodeBottomValType
    InvalidUnsignedLebBitWidth
    UnsignedLebValueOutOfRange
    InvalidSignedLebBitWidth
    SignedLebValueOutOfRange
    UnsignedLebExceedsMaxByteLimit
    SignedLebExceedsMaxByteLimit
    CannotEncodeNonStandardTypeIndex
    CannotEncodeRecursiveIndexBlockType
    InvalidMemArgEncoding
    InvalidActiveElemSequence
    InvalidTypedFunctionLocals
    InvalidNameMapOrder
    RawNameCustomSectionUnsupported
    ReservedCompilerFactsCustomSection
    UnsupportedCompilerFactsVersion
    CannotEncodeStringConstWithoutModuleContext
    StringConstLiteralMissingFromSection
    UnsupportedBackingArrayMemoryOp
    InvalidLegacyTryShape
    } derive(Eq,
    Debug
    )

    DecodeError

    pub suberror DecodeError {
    Decode(BinaryDecodeError)
    DecodeAt(BinaryDecodeError, Int, Int)
    TrailingBytes(Int, Int)
    } derive(Eq,
    Debug
    )

    impl Show for DecodeError

    EncodeError

    pub suberror EncodeError {
    Encode(BinaryEncodeError)
    } derive(Eq,
    Debug
    )

    impl Show for EncodeError

    ModuleDecodeErrorDetail

    pub struct ModuleDecodeErrorDetail {
    err : BinaryDecodeError
    section_id : Int?
    section_offset : Int?
    section_len : Int?
    trailing_offset : Int?
    } derive(Eq,
    Debug
    )

    compiler_fact_module_opcode_offsets

    fn compiler_fact_module_opcode_offsets(module_ :
    Module
    ) -> Result[Array[Array[UInt]], BinaryEncodeError]

    Return canonical instruction-opcode offsets for every defined function body using the same synthesized string-reference pool as module encoding.

    compiler_fact_module_opcode_sites

    fn compiler_fact_module_opcode_sites(module_ :
    Module
    ) -> Result[Array[Array[(UInt,
    Instruction
    )]], BinaryEncodeError]

    Return canonical (offset, instruction) maps for every defined function.

    compiler_fact_opcode_offsets

    fn compiler_fact_opcode_offsets(expression :
    Expr
    , stringrefs? : Array[Bytes]?) -> Result[Array[UInt], BinaryEncodeError]

    Return the canonical encoded byte offsets of every instruction opcode in an expression. Structural delimiter bytes such as else, catch, and end are not instruction sites.

    compiler_fact_opcode_sites

    fn compiler_fact_opcode_sites(expression :
    Expr
    , stringrefs? : Array[Bytes]?) -> Result[Array[(UInt,
    Instruction
    )], BinaryEncodeError]

    Pair canonical opcode offsets with the exact source instructions in preorder. Delimiters remain excluded, and offsets come only from the production encoder.

    decode_module

    fn decode_module(bytes : Bytes) -> Result[
    Module
    , DecodeError]

    decode_module_with_detail

    fn decode_module_with_detail(bytes : Bytes, i : Int) -> Result[(
    Module
    , Int), ModuleDecodeErrorDetail]

    encode_module

    fn encode_module(mod :
    Module
    , compact_imports? : Bool) -> Result[Bytes, EncodeError]

    encoded_module_sizes

    fn encoded_module_sizes(before :
    Module
    , after :
    Module
    ) -> Result[(Int, Int), EncodeError]

    Return exact canonical binary sizes without assembling either code section. Shared function bodies are measured once when their stringref pools agree. Local and supported type-index rewrites reuse exact expression LEB deltas. Other rewrites retain complete body encoding. Reuse is scoped to this call: mutable module data never enters a durable cache. The result includes names, compiler facts, section framing, and body framing.

    size_signed

    fn size_signed(val : Int64, nbits : Int) -> Result[Int, BinaryEncodeError]

    size_unsigned

    fn size_unsigned(val : UInt64, nbits : Int) -> Result[Int, BinaryEncodeError]