use giterated_models::object_backend::ObjectBackend; use giterated_models::{ instance::Instance, object::ObjectRequest, operation::OperationState, user::{DisplayName, User}, }; use giterated_plugin::abi::vtable::runtime::RuntimeHandle; use giterated_runtime::domain::runtime_domain_state; use giterated_runtime::{Runtime, StaticRuntimeExt}; use tracing::{info, Level}; #[tokio::main] async fn main() -> Result<(), anyhow::Error> { tracing_subscriber::fmt() .pretty() .with_thread_names(true) .with_max_level(Level::TRACE) .init(); let mut runtime = Runtime::new(); runtime.load_dylib("example_plugin_dylib.dll")?; runtime.init(); let runtime = RuntimeHandle::from_static(); let _object_request = ObjectRequest(String::from("foobar")); let mut state = giterated_plugin::abi::state::State::default(); let mut state_manager = unsafe { giterated_plugin::abi::state::StateManager::new_mut(&mut state) }; unsafe { state_manager.write_state(unsafe { runtime_domain_state() }) }; println!("state info: {:#?}", state); let _instance = runtime .get_object::("giterated.dev", &mut state) .await?; let mut user = runtime .get_object::("ambee:giterated.dev", &mut state) .await?; let display_name = user.get::(&mut state).await?; info!("Display name for user as a value: {}", display_name); let display_name = user.get_setting::(&mut state).await?; info!("Display name for user as a setting: {}", display_name); Ok(()) }