NPRPC docs

Swift API

294 declarations · 294 documented

NPRPC

  • BufferError struct

    Buffer operation error

  • check_optional_bounds function

    Check that an optional field has valid bounds Optionals have a 4-byte presence flag, followed by the relative data offset

  • check_string_bounds function

    Check that a string field has valid bounds Strings are stored like vectors of UInt8

  • check_struct_bounds function

    Check that a struct at the given offset fits within the buffer

  • check_vector_bounds function

    Check that a vector/string field has valid bounds The first 4 bytes at offset contain the relative data offset (from offset) The next 4 bytes contain the count

  • clearCookie function

    Remove a cookie on the client side by sending Max-Age=0.

  • ConnectionError struct

    Connection-related error

  • CookieOptions struct

    Options controlling a Set-Cookie response header.

  • createByteStreamReader function

    Helper to create a byte stream reader (most common case)

  • createByteStreamYielder function

    Helper to create a byte stream yielder (most common case)

  • createObjectBidiStream function

    Both halves of a bidi stream opened through a proxy's object handle. Used by generated code.

  • createObjectStreamReader function

    A reader for stream streamId opened through a proxy's object handle. Used by generated code.

  • createObjectStreamWriter function

    A writer for stream streamId opened through a proxy's object handle. Used by generated code.

  • createStreamManagerBidiStream function

    Both halves of a bidi stream on a session's stream manager. Used by generated code.

  • createStreamManagerReader function

    A reader for stream streamId on a session's stream manager, granting credits back in batches of half producerWindow. Used by generated code.

  • createStreamManagerWriter function

    A writer for stream streamId on a session's stream manager, starting with the consumer's advertised initialCredits. Used by generated code.

  • defaultReaderWindow variable

    Window a consumer advertises in StreamInit.initial_credits when opening a stream; refills are granted in batches of half this window.

  • EndPoint struct

    Network endpoint identifying a remote NPRPC object

  • FlatBuffer class

    Swift wrapper for nprpc::flat_buffer Marked as @unchecked Sendable because ownership is explicitly transferred between tasks and the underlying C++ memory is safely encapsulated.

  • getCookie function

    Read a named cookie from the current HTTP or WebSocket request.

  • getThreadId function

    Get current thread ID for logging Should match C++ thread ID for consistency in logs

  • getThreadName function

    Get current thread name for logging

  • handleStandardReply function

    Handle standard RPC reply (for client proxy) Returns 0 for success, -1 for BlockResponse (has data), or error code for errors

  • kInitialWindowSize variable

    Producer's starting credit pool when nothing was advertised (legacy peers).

  • makeSimpleAnswer function

    Create a simple answer message (for servant dispatch) Equivalent to nprpc::impl::make_simple_answer in C++

  • marshal_fundamental_array function

    Encodes a fixed-size array of plain values (T[N]). Used by generated code.

  • marshal_fundamental_vector function

    Marshal a contiguous array of trivial/fundamental elements into a flat vector.

  • marshal_optional_fundamental function

    Encodes an optional plain value (name?: T) that is present. Used by generated code.

  • marshal_optional_struct function

    Encodes an optional message that is present. Used by generated code.

  • marshal_stream_fundamental function

    Encodes a plain value as a stream chunk payload. Used by generated code.

  • marshal_stream_fundamental_vector function

    Encodes an array of plain values as a stream chunk payload. Used by generated code.

  • marshal_stream_string function

    Encodes a string as a stream chunk payload. Used by generated code.

  • marshal_stream_struct function

    Encodes a message as a stream chunk payload, growing buffer by rootSize plus extraCapacity for its variable parts. Used by generated code.

  • marshal_string function

    Marshal a Swift String as a flat vector of UTF-8 bytes (offset + count + payload). Uses the string's contiguous UTF-8 storage when available — no intermediate Array.

  • marshal_string_array function

    Encodes a fixed-size array of strings. Used by generated code.

  • marshal_string_vector function

    Encodes an array of strings as a vector<string> field. Used by generated code.

  • marshal_struct_array function

    Encodes a fixed-size array of messages. Used by generated code.

  • marshal_struct_vector function

    Encodes an array of messages as a vector<Message> field. Used by generated code.

  • narrow function

    Narrow Object reference to a specific class (for clientside proxies)

  • nplog function

    Prints message in the runtime's log format: timestamp, thread, component and a one-letter level ("I", "W", "E", ...).

  • NPRPCBidiStream struct

    Both directions of a bidi_stream method: write what you send, iterate what the other side sends.

  • NPRPCEndpoint struct

    Endpoint information for connecting to remote objects

  • NPRPCError protocol

    Base protocol for all NPRPC errors

  • NPRPCObject class

    Swift representation of a remote C++ nprpc::Object All data is accessed through the C++ object via the bridge - no duplication

  • NPRPCObjectData typealias

    Represents NPRPC object metadata for marshalling This is a typealias to the IDL-generated detail.ObjectId

  • nprpcProbeStreamInit function

    Runs body and waits until either the first stream access (via installFirstAccess) or an init-time throw / clean return.

  • NPRPCServant class

    Base class for Swift servants

  • NPRPCStreamReader class

    The receiving end of a stream: what a proxy's server_stream method returns, and what a servant's client_stream method receives.

  • NPRPCStreamWriter class

    The sending end of a stream: the writer half of a client or bidi stream, and what a servant uses to push a server_stream.

  • ObjectActivationFlags struct

    Object activation flags controlling which transports an object is available on.

  • ObjectIdPolicy enum

    Object ID policy for POA

  • PageHandler typealias

    Renders a page, or returns nil to decline the request.

  • PageRequest struct

    One HTTP request offered to a PageHandler.

  • PageResponse struct

    A handler's answer for a PageRequest.

  • Poa class

    Portable Object Adapter - manages servant lifecycle

  • PoaDispatchExecutor enum

    Where servant dispatch runs for objects activated on a POA.

  • PoaExecutor protocol

    A serial execution context that is a thread with its own event loop rather than a DispatchQueue.

  • PoaLifetime enum

    POA lifetime policy

  • Rpc class

    NPRPC runtime singleton

  • RpcBuilder class

    Root builder - entry point for fluent API

  • RpcBuilderHttp class

    HTTP/WebSocket-specific builder with SSL and page-rendering options

  • RpcBuilderProtocol protocol

    Base protocol for all RPC builders providing common configuration

  • RpcBuilderQuic class

    QUIC-specific builder with TLS configuration

  • RpcBuilderTcp class

    TCP-specific builder

  • RpcConfiguration struct

    Configuration for NPRPC runtime

  • RuntimeError struct

    Generic NPRPC runtime error

  • setCookie function

    Queue a Set-Cookie header to be included in the HTTP response.

  • StreamInitProbeResult enum

    Result of probing whether a stream servant method failed during init.

  • StreamYielder class

    Server-side stream yielder for sending data chunks to client

  • TransportType enum

    Transport protocol for NPRPC communication

  • UnexpectedReplyError struct

    Unexpected reply error

  • unmarshal_fundamental_array function

    Decodes a fixed-size array of plain values. Used by generated code.

  • unmarshal_fundamental_vector function

    Unmarshal a flat vector of fundamental elements with a single bulk copy (same path as unmarshal_fundamental_array).

  • unmarshal_object_proxy function

    Unmarshal a remote object reference from flat buffer This is the Swift equivalent of C++ create_object_from_flat Pass the raw buffer pointer directly to C++ to avoid data duplication

  • unmarshal_optional_fundamental function

    Decodes an optional plain value; nil when absent. Used by generated code.

  • unmarshal_optional_struct function

    Decodes an optional message; nil when absent. Used by generated code.

  • unmarshal_stream_fundamental_vector function

    Decodes an array of plain values from a stream chunk payload. Used by generated code.

  • unmarshal_string function

    Unmarshal a UTF-8 flat string. Builds String directly from the wire bytes (no intermediate Data allocation).

  • unmarshal_string_array function

    Decodes a fixed-size array of strings. Used by generated code.

  • unmarshal_string_vector function

    Decodes a vector<string> field. Used by generated code.

  • unmarshal_struct_array function

    Decodes a fixed-size array of messages. Used by generated code.

  • unmarshal_struct_vector function

    Decodes a vector<Message> field. Used by generated code.

NPRPCWeb