Expand description
Types that can cross the FFI boundary.
Modules
- Callback interfaces are traits specified in UDL which can be implemented by foreign languages.
- FfiDefault trait
- This module contains code to handle foreign callbacks - C-ABI functions that are defined by a foreign language, then registered with UniFFI. These callbacks are used to implement callback interfaces, async scheduling etc. Foreign callbacks are registered at startup, when the foreign code loads the exported library. For each callback type, we also define a “cell” type for storing the callback.
- This module defines a Rust Future that wraps an async foreign function call.
- Low-level support for calling rust functions
Structs
- Support for reading a slice of foreign-language-allocated bytes over the FFI.
- Perform a call to a foreign async method C struct that represents the foreign future.
- C struct that represents the result of a foreign future
- Object handle
- Support for passing an allocated-by-Rust buffer of bytes over the FFI.
- Represents the success/error of a rust call
- Used when internal/unexpected error happened when calling a foreign callback, for example when a unknown exception is raised
Enums
- Result of a FFI call to a Rust function
- Result code for rust_future_poll. This is passed to the continuation function.
Traits
Functions
- Handle a scaffolding calls
- Cancel a Rust future
- Complete a Rust future
- Free a Rust future, dropping the strong reference and releasing all references held by the future.
- Create a new Handle for a Rust future
- Poll a Rust future
- This helper allocates a new byte buffer owned by the Rust code, and returns it to the foreign-language code as a
RustBuffer
struct. Callers must eventually free the resulting buffer, either by explicitly callinguniffi_rustbuffer_free
defined below, or by passing ownership of the buffer back into Rust code. - Free a byte buffer that had previously been passed to the foreign language code.
- This helper copies bytes owned by the foreign-language code into a new byte buffer owned by the Rust code, and returns it as a
RustBuffer
struct. Callers must eventually free the resulting buffer, either by explicitly calling the destructor defined below, or by passing ownership of the buffer back into Rust code. - Reserve additional capacity in a byte buffer that had previously been passed to the foreign language code.
Type Definitions
- Callback that’s passed to a foreign async functions.
- Handle for a callback data associated with a foreign future.
- Handle for a foreign future
- Foreign callback that’s passed to rust_future_poll