Skip to main content

Crate ic_wire_endpoint

Crate ic_wire_endpoint 

Source
Expand description

Typed IC entrypoints, owned by the independently released endpoint integration.

Bare query and update derive an identity from the exported method name and use DEFAULT_REQUEST_LIMITS / DEFAULT_RESPONSE_LIMITS. Optional id, request and response constant expressions override those choices. A handler takes zero arguments (a framed unit request) or one owned Serde value. Synchronous handlers can select borrow with one request: borrowed fields and replies refer to Platform’s argument vector, retained through reply encoding. This avoids a second field copy; the initial ingress copy is still required. Async handlers remain owned. Framing, budgets and validation are unchanged. query(composite, ...) selects a composite query. Async handlers use Platform’s protected executor. name = "..." overrides the export name; crate = "path" selects a renamed/re-exported endpoint crate.

Optional contract = NAME exposes a typed Contract constant taken from the exact signature and settings. Its native schema methods delegate to existing Wire projection; no automatic registry, custom Wasm metadata section or artifact admission is installed.

Encoding failures trap, rolling back a synchronous update’s mutations. Async updates follow ordinary IC transactions: state committed before an inter-canister await cannot be rolled back by a later reply-encoding trap. Only the current callback’s changes roll back. Query state is not persisted.

Frameworks may instead pass the helpers below to Platform’s codec hooks around their existing guarded handlers. Admission must run as a Platform guard before its argument copy. Framework access refusals, dispatch, registration and final artifact checks remain framework-owned; do not stack two export macros.

Modules§

native
Optional typed IC entrypoints using Platform’s export generator and executor. Explicit resource admission for native Serde payloads in the same Postcard format.

Structs§

Contract
A handler’s types and explicit frame settings, without a registry or transport.
Limits
Consumer-selected allowances for Serde traversal.

Enums§

Error
Typed codec/admission failure, distinct from transport and application errors.

Constants§

DEFAULT_REQUEST_LIMITS
Default full-frame request limits for the optional endpoint integration.
DEFAULT_RESPONSE_LIMITS
Default full-frame response limits, with the same values as the request defaults. Request and response overrides remain independent; reply failure still traps.

Functions§

admit_request
Trap on an oversized ingress before Platform allocates/copies argument bytes.
decode_request
Decode a complete native request frame, trapping on typed codec failure.
encode_response
Encode the native response frame within its allowances, trapping on failure.

Attribute Macros§

query
Connect a typed Wire query to Platform’s maintained entrypoint generator.
update
Connect a typed Wire update to Platform’s maintained entrypoint generator.