Skip to main content

Crate apiplant_abi

Crate apiplant_abi 

Source
Expand description

§apiplant-abi

The stable, C-compatible ABI contract that sits between the apiplant host and every dynamically-loaded function library (.so/.dylib/.dll).

Both sides depend only on this crate and on abi_stable, which means a function compiled against version X of this crate keeps working against a host compiled against the same major version — no matter which compiler, allocator or std version each side was built with. That is the whole point of routing everything through #[repr(C)] + StableAbi types.

§The shape of a function

A function library exports exactly one root module (FunctionMod) whose new_functions constructor yields one or more Function trait objects — a single library can provide a whole set of independently-named functions. For each of them the host:

  1. reads its FunctionManifest (name, visibility, HTTP method, config schema),
  2. mounts it on an HTTP endpoint according to its Visibility,
  3. on each request calls Function::invoke, passing a HostApi handle (database access, logging, resolved config) plus a JSON input string,
  4. returns the JSON the function produced.

Everything crosses the boundary as JSON (RString) or as small #[repr(C)] enums. Nothing sea-orm / ntex / tokio ever touches the ABI, so the contract stays tiny and genuinely stable.

Modules§

Function_trait
This module is generated by the #[sabi_trait] attribute on Function
HostApi_trait
This module is generated by the #[sabi_trait] attribute on HostApi
c
A plain C ABI, for functions written in something other than Rust.

Structs§

FunctionManifest
Static description of a function, read once at load time.
FunctionMod
The root module every function library exports.
FunctionMod_Prefix
This is the prefix fields of FunctionMod, accessible through FunctionMod_Ref, with .0.prefix().
FunctionMod_Ref
This is the pointer to the prefix of FunctionMod.
Function_TO
The trait object for Function.
HostApi_TO
The trait object for HostApi.

Enums§

FunctionAccess
A function’s effective access policy — the resolved form of FunctionManifest::permission, falling back to Visibility.
HttpMethod
HTTP verb a function endpoint responds to.
LogLevel
Severity for HostApi::log.
Visibility
Who is allowed to call a function’s (or resource’s) endpoint.

Constants§

INTERNAL_ERROR_PREFIX
Marks an Function::invoke error as the function’s own fault — a panic or an internal fault — rather than a complaint about the caller’s input.

Traits§

Function
A loaded function instance. Constructed once per library via FunctionMod::new_functions and reused across requests, so it must be Send + Sync.
HostApi
Services the host lends to a function for the duration of one invocation.

Type Aliases§

BoxedFunction
Convenience alias for the boxed function trait object the host works with.
Function_CTO
A type alias for the const-constructible Function_TO.
HostApi_CTO
A type alias for the const-constructible HostApi_TO.