pub fn list_modules() -> Vec<u8> ⓘ
Expand description
Returns a serialized JSON vector of bytes with a list of external registration info.
Only registration info from behavior modules listed in a Cargo.toml’s Ark annotation will be returned
§Example
At a bare minimum, the JSON vector can be deserialized into a vector of BehaviorModuleRegistration
:
ⓘ
use ark_api_ffi::behavior_controller_v0::{BehaviorModuleRegistration};
let list: Vec<BehaviorModuleRegistration> = serde_json::from_slice(list_modules()).unwrap();
If behavior modules were registered with a custom registration format they can be deserialized similarly:
ⓘ
use ark_api_ffi::behavior_controller_v0::{BehaviorModuleRegistration};
// Custom data format used in behavior module registration
#[derive(serde::Deserialize)]
pub struct CustomRegistrationInfo {
#[serde(flatten)]
pub info: BehaviorModuleRegistration,
pub module_name: String,
pub module_version: u32,
}
let list: Vec<CustomRegistrationInfo> = serde_json::from_slice(list_modules()).unwrap();