A C representation of the Rust [ModuleLoader] interface. User can provide [ModuleLoader] methods implemented in C.
More...
#include <hyperon.h>
|
| intptr_t(* | load )(const void *payload, struct run_context_t *context, struct write_t err) |
| | A function to load the module my making MeTTa API calls.
|
| intptr_t(* | load_tokens )(const void *payload, struct metta_mod_ref_t target, struct metta_t metta, struct write_t err) |
| | Loads module's tokens into target module. This method is used for both initial token loading and exporting module's tokens into importing module.
|
| void(* | to_string )(const void *payload, struct write_t text) |
| | Prints module loader content as a string, used for implementing [std::fmt::Debug].
|
| void(* | free )(void *payload) |
| | Frees module loader and all associated memory.
|
A C representation of the Rust [ModuleLoader] interface. User can provide [ModuleLoader] methods implemented in C.
◆ free
| void(* module_loader_t::free) (void *payload) |
Frees module loader and all associated memory.
- Parameters
-
| [in] | payload | The module loader self pointer |
◆ load
| intptr_t(* module_loader_t::load) (const void *payload, struct run_context_t *context, struct write_t err) |
A function to load the module my making MeTTa API calls.
- Parameters
-
| [in] | payload | The module loader self pointer |
| [in] | run_context | The run_context_t to provide access to the MeTTa run interface |
| [in] | err | The writer to fill with error message if any |
- Returns
- 0 if success, non-zero otherwise; code should put the explanation text to the err field.
◆ load_tokens
Loads module's tokens into target module. This method is used for both initial token loading and exporting module's tokens into importing module.
- Parameters
-
| [in] | payload | The module loader self pointer |
| [in] | target | The module to load tokens into |
| [in] | metta | The context MeTTa runner |
| [in] | err | The writer to fill with error message if any |
- Returns
- 0 if success, non-zero otherwise; code should put the explanation text to the err field.
◆ to_string
| void(* module_loader_t::to_string) (const void *payload, struct write_t text) |
Prints module loader content as a string, used for implementing [std::fmt::Debug].
- Parameters
-
| [in] | payload | The module loader self pointer |
| [in] | text | Object to write the text into |
The documentation for this struct was generated from the following file:
- hyperonc-install/include/hyperonc/hyperon/hyperon.h