Skip to content

SocketResultDecoder

[Source]

Decodes the U8 returned by the five pony_os_* socket runtime functions (pony_os_writev, pony_os_send, pony_os_recv, pony_os_sendto, pony_os_recvfrom) into a SocketResult union.

This is the Pony-side dual of pony_socket_result_t defined in src/libponyrt/lang/socket.h of ponyc. The integer values produced by the SocketResultOk/SocketResultRetry/SocketResultError primitives' apply() methods must match the C-side PONY_SOCKET_OK/ PONY_SOCKET_RETRY/PONY_SOCKET_ERROR constants, which are part of the FFI ABI. Keep both files in sync.

Any out-of-range U8 is collapsed to SocketResultError so unknown C-side values fail closed. Adding a new wire value on the C side requires updating both the SocketResult union and this decoder.

primitive val SocketResultDecoder

Constructors

create

[Source]

new val create()
: SocketResultDecoder val^

Returns


Public Functions

apply

[Source]

fun box apply(
  v: U8 val)
: SocketResult

Parameters

  • v: U8 val

Returns


eq

[Source]

fun box eq(
  that: SocketResultDecoder val)
: Bool val

Parameters

Returns


ne

[Source]

fun box ne(
  that: SocketResultDecoder val)
: Bool val

Parameters

Returns