nupp.mem.representation.spi

Implementation interfaces consumed during ordinary module initialization. Discover with nupp.spi.load; the consumer chooses the unique highest priority. Omitted priority is zero. Importing these declarations loads no implementation.

Module contents

Types

TypeKindDescription
CastElementstypeCasts storage to elements of any supplied ctype.
CstorageProviderinterfaceA coherent family of physical storage operations.
StructvalueProviderinterfaceStruct-value operations supplied as part of the storage family.

Types#

CastElementstype#

type CastElements = function<T>(element: ctype<T>, pointer: any): any

Casts storage to elements of any supplied ctype.

The implementation must remain generic in T and use the target's representation; accepting one particular element type is not sufficient.

CstorageProviderinterface#

interface CstorageProvider ...

A coherent family of physical storage operations.

representation is native, the only family Nupp compiles for, and the facade checks it before publishing this table: a provider built for some other layout cannot be selected into a program whose layout is already compiled.

Allocation, descriptors, scalar codecs, and copies must agree on byte order, alignment, width, and pointer units. Decode inputs contain at least the scalar width in bytes. Borrowed views preserve source lifetimes; borrows, generic casts, and const views are part of the implementation contract. Opaque values in these signatures carry provider storage, not permission to change a compiled representation at runtime.

Members

NameKindDescription
priorityfield
boundedCountmethodReturns the requested count after any representation-specific extent check.
representationfieldThe storage family this table implements, which must be native.
structsfieldStruct descriptors and row operations sharing this storage family.
layoutfieldReturns target layout facts for a type or descriptor, where the family reports them.
scalarmethodReturns the canonical descriptor for a scalar kind within this provider.
descriptormethodReports layout and bounds for a provider value.
referencefieldCreates a deferred descriptor reference for recursive layouts.
allocateArraymethodAllocates count elements of the supplied descriptor.
allocateBytesmethodAllocates a writable byte region containing count bytes.
borrowStringmethodReturns a read-only byte view whose lifetime borrows the source string.
castBytesmethodReturns a read-only byte view borrowing the pointer owner.
castElementsfieldInterprets a pointer using any supplied element ctype.
copymethodCopies count bytes into destination without replacing its owner.
fillmethodFills count bytes in destination with the given byte value.
sizeOfmethodReturns the descriptor size in bytes.
stringmethodCopies count source bytes into an independent Lua string.
decodeUint8methodDecodes a unsigned 8-bit integer using the target storage byte order.
encodeUint8methodEncodes a unsigned 8-bit integer using the target storage byte order.
decodeInt8methodDecodes a signed 8-bit integer using the target storage byte order.
encodeInt8methodEncodes a signed 8-bit integer using the target storage byte order.
decodeUint16methodDecodes a unsigned 16-bit integer using the target storage byte order.
encodeUint16methodEncodes a unsigned 16-bit integer using the target storage byte order.
decodeInt16methodDecodes a signed 16-bit integer using the target storage byte order.
encodeInt16methodEncodes a signed 16-bit integer using the target storage byte order.
decodeUint32methodDecodes a unsigned 32-bit integer using the target storage byte order.
encodeUint32methodEncodes a unsigned 32-bit integer using the target storage byte order.
decodeInt32methodDecodes a signed 32-bit integer using the target storage byte order.
encodeInt32methodEncodes a signed 32-bit integer using the target storage byte order.
decodeUint64methodDecodes a unsigned 64-bit integer using the target storage byte order.
encodeUint64methodEncodes a unsigned 64-bit integer using the target storage byte order.
decodeInt64methodDecodes a signed 64-bit integer using the target storage byte order.
encodeInt64methodEncodes a signed 64-bit integer using the target storage byte order.
decodeFloat32methodDecodes an IEEE-754 binary32 value using the target storage byte order.
encodeFloat32methodEncodes an IEEE-754 binary32 value using the target storage byte order.
decodeFloat64methodDecodes an IEEE-754 binary64 value using the target storage byte order.
encodeFloat64methodEncodes an IEEE-754 binary64 value using the target storage byte order.

priorityfield#

priority: integer?
@readonly

boundedCountmethod#

boundedCount: function(borrows source: any, count: integer): integer
@readonly

Returns the requested count after any representation-specific extent check. Callers remain responsible for valid native pointer extents.

Arguments
NameTypeDescription
borrows sourceany
countinteger
Returns
TypeDescription
integer

representationfield#

representation: string
@readonly

The storage family this table implements, which must be native.

structsfield#

@readonly

Struct descriptors and row operations sharing this storage family.

layoutfield#

layout: (function(subject: any): any)?
@readonly

Returns target layout facts for a type or descriptor, where the family reports them.

scalarmethod#

scalar: function(kind: string): any
@readonly

Returns the canonical descriptor for a scalar kind within this provider.

Arguments
NameTypeDescription
kindstring
Returns
TypeDescription
any

descriptormethod#

descriptor: function(value: any): any
@readonly

Reports layout and bounds for a provider value.

Arguments
NameTypeDescription
valueany
Returns
TypeDescription
any

referencefield#

reference: (function(resolve: function(): any): any)?
@readonly

Creates a deferred descriptor reference for recursive layouts.

allocateArraymethod#

allocateArray: function(element: any, count: integer): any
@readonly

Allocates count elements of the supplied descriptor.

Arguments
NameTypeDescription
elementany
countinteger
Returns
TypeDescription
any

allocateBytesmethod#

allocateBytes: function(count: integer): uint8[?]
@readonly

Allocates a writable byte region containing count bytes.

Arguments
NameTypeDescription
countinteger
Returns
TypeDescription
uint8[?]

borrowStringmethod#

borrowString: function(borrows bytes: string): const uint8[?] borrows (bytes)
@readonly

Returns a read-only byte view whose lifetime borrows the source string.

Arguments
NameTypeDescription
borrows bytesstring
Returns
TypeDescription
const uint8[?] borrows (bytes)

castBytesmethod#

castBytes: function(borrows pointer: any): const uint8[?] borrows (pointer)
@readonly

Returns a read-only byte view borrowing the pointer owner.

Arguments
NameTypeDescription
borrows pointerany
Returns
TypeDescription
const uint8[?] borrows (pointer)

castElementsfield#

castElements: CastElements
@readonly

Interprets a pointer using any supplied element ctype.

copymethod#

copy: function(borrows destination: any, borrows source: any, count: integer): nil
@readonly

Copies count bytes into destination without replacing its owner.

Arguments
NameTypeDescription
borrows destinationany
borrows sourceany
countinteger
Returns
TypeDescription
nil

fillmethod#

fill: function(destination: any, count: integer, value: integer): nil
@readonly

Fills count bytes in destination with the given byte value.

Arguments
NameTypeDescription
destinationany
countinteger
valueinteger
Returns
TypeDescription
nil

sizeOfmethod#

sizeOf: function(element: any): integer
@readonly

Returns the descriptor size in bytes.

Arguments
NameTypeDescription
elementany
Returns
TypeDescription
integer

stringmethod#

string: function(borrows source: any, count: integer): string
@readonly

Copies count source bytes into an independent Lua string.

Arguments
NameTypeDescription
borrows sourceany
countinteger
Returns
TypeDescription
string

decodeUint8method#

decodeUint8: function(bytes: string): uint32
@readonly

Decodes a unsigned 8-bit integer using the target storage byte order.

Arguments
NameTypeDescription
bytesstring
Returns
TypeDescription
uint32

encodeUint8method#

encodeUint8: function(value: uint32): string
@readonly

Encodes a unsigned 8-bit integer using the target storage byte order.

Arguments
NameTypeDescription
valueuint32
Returns
TypeDescription
string

decodeInt8method#

decodeInt8: function(bytes: string): int32
@readonly

Decodes a signed 8-bit integer using the target storage byte order.

Arguments
NameTypeDescription
bytesstring
Returns
TypeDescription
int32

encodeInt8method#

encodeInt8: function(value: int32): string
@readonly

Encodes a signed 8-bit integer using the target storage byte order.

Arguments
NameTypeDescription
valueint32
Returns
TypeDescription
string

decodeUint16method#

decodeUint16: function(bytes: string): uint32
@readonly

Decodes a unsigned 16-bit integer using the target storage byte order.

Arguments
NameTypeDescription
bytesstring
Returns
TypeDescription
uint32

encodeUint16method#

encodeUint16: function(value: uint32): string
@readonly

Encodes a unsigned 16-bit integer using the target storage byte order.

Arguments
NameTypeDescription
valueuint32
Returns
TypeDescription
string

decodeInt16method#

decodeInt16: function(bytes: string): int32
@readonly

Decodes a signed 16-bit integer using the target storage byte order.

Arguments
NameTypeDescription
bytesstring
Returns
TypeDescription
int32

encodeInt16method#

encodeInt16: function(value: int32): string
@readonly

Encodes a signed 16-bit integer using the target storage byte order.

Arguments
NameTypeDescription
valueint32
Returns
TypeDescription
string

decodeUint32method#

decodeUint32: function(bytes: string): uint32
@readonly

Decodes a unsigned 32-bit integer using the target storage byte order.

Arguments
NameTypeDescription
bytesstring
Returns
TypeDescription
uint32

encodeUint32method#

encodeUint32: function(value: uint32): string
@readonly

Encodes a unsigned 32-bit integer using the target storage byte order.

Arguments
NameTypeDescription
valueuint32
Returns
TypeDescription
string

decodeInt32method#

decodeInt32: function(bytes: string): int32
@readonly

Decodes a signed 32-bit integer using the target storage byte order.

Arguments
NameTypeDescription
bytesstring
Returns
TypeDescription
int32

encodeInt32method#

encodeInt32: function(value: int32): string
@readonly

Encodes a signed 32-bit integer using the target storage byte order.

Arguments
NameTypeDescription
valueint32
Returns
TypeDescription
string

decodeUint64method#

decodeUint64: function(bytes: string): uint64
@readonly

Decodes a unsigned 64-bit integer using the target storage byte order.

Arguments
NameTypeDescription
bytesstring
Returns
TypeDescription
uint64

encodeUint64method#

encodeUint64: function(value: uint64): string
@readonly

Encodes a unsigned 64-bit integer using the target storage byte order.

Arguments
NameTypeDescription
valueuint64
Returns
TypeDescription
string

decodeInt64method#

decodeInt64: function(bytes: string): int64
@readonly

Decodes a signed 64-bit integer using the target storage byte order.

Arguments
NameTypeDescription
bytesstring
Returns
TypeDescription
int64

encodeInt64method#

encodeInt64: function(value: int64): string
@readonly

Encodes a signed 64-bit integer using the target storage byte order.

Arguments
NameTypeDescription
valueint64
Returns
TypeDescription
string

decodeFloat32method#

decodeFloat32: function(bytes: string): float
@readonly

Decodes an IEEE-754 binary32 value using the target storage byte order.

Arguments
NameTypeDescription
bytesstring
Returns
TypeDescription
float

encodeFloat32method#

encodeFloat32: function(value: number): string
@readonly

Encodes an IEEE-754 binary32 value using the target storage byte order.

Arguments
NameTypeDescription
valuenumber
Returns
TypeDescription
string

decodeFloat64method#

decodeFloat64: function(bytes: string): number
@readonly

Decodes an IEEE-754 binary64 value using the target storage byte order.

Arguments
NameTypeDescription
bytesstring
Returns
TypeDescription
number

encodeFloat64method#

encodeFloat64: function(value: number): string
@readonly

Encodes an IEEE-754 binary64 value using the target storage byte order.

Arguments
NameTypeDescription
valuenumber
Returns
TypeDescription
string

StructvalueProviderinterface#

interface StructvalueProvider ...

Struct-value operations supplied as part of the storage family.

Descriptors, arrays, and constructed values must agree with compiler layouts and canonical struct declarations. referenceValued reports whether a row reference addresses the underlying storage. The storage implementation supplies compatible struct operations as part of the same family.

Members

NameKindDescription
scalarmethodReturns a scalar descriptor accepted by define and array.
arraymethodAllocates count elements using this family's element descriptor.
definemethodConstructs a type descriptor from a compiler layout and method table.
referenceValuedfieldWhether row references address their underlying storage.

scalarmethod#

scalar: function(kind: string): any
@readonly

Returns a scalar descriptor accepted by define and array.

Arguments
NameTypeDescription
kindstring
Returns
TypeDescription
any

arraymethod#

array: function(element: any, count: integer): any
@readonly

Allocates count elements using this family's element descriptor.

Arguments
NameTypeDescription
elementany
countinteger
Returns
TypeDescription
any

definemethod#

define: function(layout: any, methods: table): any
@readonly

Constructs a type descriptor from a compiler layout and method table.

Arguments
NameTypeDescription
layoutany
methodstable
Returns
TypeDescription
any

referenceValuedfield#

referenceValued: boolean
@readonly

Whether row references address their underlying storage.