Swift API
344 declarations · 326 documented
NPRPC
-
BufferErrorstructBuffer operation error
-
check_alignmentfunctionValidate the actual address before an aligned Swift load.
-
check_optional_boundsfunctionCheck that an optional field has valid bounds Optionals have a 4-byte presence flag, followed by the relative data offset
-
check_string_boundsfunctionCheck that a string field has valid bounds Strings are stored like vectors of UInt8
-
check_struct_boundsfunctionCheck that a struct at the given offset fits within the buffer
-
check_vector_boundsfunctionCheck 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
-
clearCookiefunctionRemove a cookie on the client side by sending
Max-Age=0. -
ConnectionErrorstructConnection-related error
-
CookieOptionsstructOptions controlling a
Set-Cookieresponse header. -
createByteStreamReaderfunctionHelper to create a byte stream reader (most common case)
-
createByteStreamYielderfunctionHelper to create a byte stream yielder (most common case)
-
createObjectBidiStreamfunctionBoth halves of a bidi stream opened through a proxy's object handle. Used by generated code.
-
createObjectStreamReaderfunctionA reader for stream
streamIdopened through a proxy's object handle. Used by generated code. -
createObjectStreamWriterfunctionA writer for stream
streamIdopened through a proxy's object handle. Used by generated code. -
createStreamManagerBidiStreamfunctionBoth halves of a bidi stream on a session's stream manager. Used by generated code.
-
createStreamManagerReaderfunctionA reader for stream
streamIdon a session's stream manager, granting credits back in batches of halfproducerWindow. Used by generated code. -
createStreamManagerWriterfunctionA writer for stream
streamIdon a session's stream manager, starting with the consumer's advertisedinitialCredits. Used by generated code. -
currentCallIsCancelledvariableInside a servant method: whether the client cancelled this call or went away. A long-running method can check this and stop early. It only ever turns true on a POA created with a
dispatch:other than.inlineOnTransportThread. -
defaultReaderWindowvariableWindow a consumer advertises in StreamInit.initial_credits when opening a stream; refills are granted in batches of half this window.
-
EndPointstructNetwork endpoint identifying a remote NPRPC object
-
FlatBufferclassSwift wrapper for nprpc::flat_buffer Marked as @unchecked Sendable because ownership is explicitly transferred between tasks and the underlying C++ memory is safely encapsulated.
-
getCookiefunctionRead a named cookie from the current HTTP or WebSocket request.
-
getThreadIdfunctionGet current thread ID for logging Should match C++ thread ID for consistency in logs
-
getThreadNamefunctionGet current thread name for logging
-
handleStandardReplyfunctionHandle standard RPC reply (for client proxy) Returns 0 for success, -1 for BlockResponse (has data), or error code for errors
-
kInitialWindowSizevariableProducer's starting credit pool when nothing was advertised (legacy peers).
-
makeSimpleAnswerfunctionCreate a simple answer message (for servant dispatch) Equivalent to nprpc::impl::make_simple_answer in C++
-
marshal_fundamental_arrayfunctionEncodes a fixed-size array of plain values (
T[N]). Used by generated code. -
marshal_fundamental_vectorfunctionMarshal a contiguous array of trivial/fundamental elements into a flat vector.
-
marshal_optional_fundamentalfunctionEncodes an optional plain value (
name?: T) that is present. Used by generated code. -
marshal_optional_structfunctionEncodes an optional message that is present. Used by generated code.
-
marshal_stream_fundamentalfunctionEncodes a plain value as a stream chunk payload. Used by generated code.
-
marshal_stream_fundamental_vectorfunctionEncodes an array of plain values as a stream chunk payload. Used by generated code.
-
marshal_stream_stringfunctionEncodes a string as a stream chunk payload. Used by generated code.
-
marshal_stream_structfunctionEncodes a message as a stream chunk payload, growing
bufferbyrootSizeplusextraCapacityfor its variable parts. Used by generated code. -
marshal_stringfunctionMarshal 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_arrayfunctionEncodes a fixed-size array of strings. Used by generated code.
-
marshal_string_vectorfunctionEncodes an array of strings as a
vector<string>field. Used by generated code. -
marshal_struct_arrayfunctionEncodes a fixed-size array of messages. Used by generated code.
-
marshal_struct_vectorfunctionEncodes an array of messages as a
vector<Message>field. Used by generated code. -
narrowfunctionNarrow Object reference to a specific class (for clientside proxies)
-
narrowFailurefunctionWhy
narrowreturned nil, for an error message. The part of a class ID after the#is a hash of the interface's IDL, so two IDs that differ only there are the same interface built from different versions of its IDL. -
nplogfunctionPrints
messagein the runtime's log format: timestamp, thread,componentand a one-letterlevel("I", "W", "E", ...). -
NPRPCBidiStreamstructBoth directions of a
bidi_streammethod: write what you send, iterate what the other side sends. -
NPRPCDeferredCallclassA
[coroutine]servant method on its way: generated dispatch begins one, and it sends the reply once the method returns. On a POA with adispatch:other than.inlineOnTransportThread, the method keeps running on that executor across its awaits. A client's cancellation cancels its task. -
NPRPCEndpointstructEndpoint information for connecting to remote objects
-
NPRPCErrorprotocolBase protocol for all NPRPC errors
-
NPRPCObjectclassSwift representation of a remote C++ nprpc::Object All data is accessed through the C++ object via the bridge - no duplication
-
NPRPCObjectDatatypealiasRepresents NPRPC object metadata for marshalling This is a typealias to the IDL-generated detail.ObjectId
-
nprpcProbeStreamInitfunctionRuns
bodyand waits until either the first stream access (viainstallFirstAccess) or an init-time throw / clean return. -
NPRPCServantclassBase class for Swift servants
-
NPRPCStreamReaderclassThe receiving end of a stream: what a proxy's
server_streammethod returns, and what a servant'sclient_streammethod receives. -
NPRPCStreamWriterclassThe sending end of a stream: the writer half of a client or bidi stream, and what a servant uses to push a
server_stream. -
ObjectActivationFlagsstructObject activation flags controlling which transports an object is available on.
-
ObjectIdPolicyenumObject ID policy for POA
-
openStreamfunctionSends a prepared StreamInit and arms the stream if the server accepts it. Returns true if the reply is an IDL exception, which is left in
buffer, and throws for anything else that isn't success.onFailureruns before either, to clean up what was registered for the stream. Used by generated code. -
PageHandlertypealiasRenders a page, or returns
nilto decline the request. -
PageRequeststructOne HTTP request offered to a
PageHandler. -
PageResponsestructA handler's answer for a
PageRequest. -
PoaclassPortable Object Adapter - manages servant lifecycle
-
PoaDispatchExecutorenumWhere servant
dispatchruns for objects activated on a POA. -
PoaExecutorprotocolA serial execution context that is a thread with its own event loop rather than a
DispatchQueue. -
PoaLifetimeenumPOA lifetime policy
-
RpcclassNPRPC runtime singleton
-
RpcBuilderclassRoot builder - entry point for fluent API
-
RpcBuilderHttpclassHTTP/WebSocket-specific builder with SSL and page-rendering options
-
RpcBuilderProtocolprotocolBase protocol for all RPC builders providing common configuration
-
RpcBuilderQuicclassQUIC-specific builder with TLS configuration
-
RpcBuilderTcpclassTCP-specific builder
-
RpcConfigurationstructConfiguration for NPRPC runtime
-
RpcErrorstructA local RPC setup or transport failure. Remote IDL errors retain their generated types and are decoded from a successful transport response.
-
RuntimeErrorstructGeneric NPRPC runtime error
-
setCookiefunctionQueue a
Set-Cookieheader to be included in the HTTP response. -
StreamInitProbeResultenumResult of probing whether a stream servant method failed during init.
-
StreamYielderclassServer-side stream yielder for sending data chunks to client
-
TransportTypeenumTransport protocol for NPRPC communication
-
UnexpectedReplyErrorstructUnexpected reply error
-
UniqueFDclassAn owned file descriptor: closed when the last reference goes away.
-
unmarshal_fundamental_arrayfunctionDecodes a fixed-size array of plain values. Used by generated code.
-
unmarshal_fundamental_vectorfunctionUnmarshal a flat vector of fundamental elements with a single bulk copy (same path as
unmarshal_fundamental_array). -
unmarshal_object_proxyfunctionUnmarshal 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_fundamentalfunctionDecodes an optional plain value; nil when absent. Used by generated code.
-
unmarshal_optional_structfunctionDecodes an optional message; nil when absent. Used by generated code.
-
unmarshal_stream_fundamental_vectorfunctionDecodes an array of plain values from a stream chunk payload. Used by generated code.
-
unmarshal_stringfunctionUnmarshal a UTF-8 flat string. Builds
Stringdirectly from the wire bytes (no intermediateDataallocation). -
unmarshal_string_arrayfunctionDecodes a fixed-size array of strings. Used by generated code.
-
unmarshal_string_vectorfunctionDecodes a
vector<string>field. Used by generated code. -
unmarshal_struct_arrayfunctionDecodes a fixed-size array of messages. Used by generated code.
-
unmarshal_struct_vectorfunctionDecodes a
vector<Message>field. Used by generated code.
NPRPCWeb
-
TemplateErrorenumWhy a
TemplateLibrarycould not load its directory. -
TemplateLibraryclassLoads a directory of
.mustachefiles and renders from it.