pub struct PluginContext { /* private fields */ }Implementations§
Source§impl PluginContext
impl PluginContext
Sourcepub fn new(
data_dir: PathBuf,
llm_executor: Arc<dyn LlmExecutor>,
plugin_config: Value,
storage: Arc<StorageRegistry>,
plugin_namespace: String,
storage_config_resolver: Arc<dyn StorageConfigResolver>,
current_context_rx: Receiver<Value>,
) -> Self
pub fn new( data_dir: PathBuf, llm_executor: Arc<dyn LlmExecutor>, plugin_config: Value, storage: Arc<StorageRegistry>, plugin_namespace: String, storage_config_resolver: Arc<dyn StorageConfigResolver>, current_context_rx: Receiver<Value>, ) -> Self
Internal constructor used by the Core AI engine.
pub fn llm_executor(&self) -> Arc<dyn LlmExecutor> ⓘ
Sourcepub fn config<C: DeserializeOwned>(&self) -> Result<C, String>
pub fn config<C: DeserializeOwned>(&self) -> Result<C, String>
Deserializes the raw JSON configuration into the plugin’s requested config struct.
Note on Serde Configuration Defaults:
This performs strict structural deserialization. If the JSON object provided by the
ConfigProvider is missing a field that your Rust struct (which must derive Deserialize) expects, serde will
return a missing field error — even if your struct implements Default.
To make a configuration field optional, use the #[serde(default)]
attribute on the struct field. This instructs serde to fall back to Default::default()
when the key is omitted.
Sourcepub async fn store<S: StorageConnection>(&self) -> Result<S, String>
pub async fn store<S: StorageConnection>(&self) -> Result<S, String>
Initializes and returns a database connection scoped strictly to this plugin’s namespace.
Sourcepub fn subscribe_context_updates(&self) -> Receiver<Value>
pub fn subscribe_context_updates(&self) -> Receiver<Value>
Read-only subscription channel to receive the global state updates
Trait Implementations§
Source§impl Clone for PluginContext
impl Clone for PluginContext
Source§fn clone(&self) -> PluginContext
fn clone(&self) -> PluginContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more