pub struct PluginManager { /* private fields */ }Expand description
插件管理器
Implementations§
Source§impl PluginManager
impl PluginManager
Sourcepub fn new(agent_id: &str) -> PluginManager
pub fn new(agent_id: &str) -> PluginManager
创建新的插件管理器
Sourcepub fn context(&self) -> &PluginContext
pub fn context(&self) -> &PluginContext
获取插件上下文
Sourcepub async fn register<P>(&self, plugin: P) -> Result<(), Error>where
P: AgentPlugin + 'static,
pub async fn register<P>(&self, plugin: P) -> Result<(), Error>where
P: AgentPlugin + 'static,
注册插件
Sourcepub async fn register_with_config<P>(
&self,
plugin: P,
config: PluginConfig,
) -> Result<(), Error>where
P: AgentPlugin + 'static,
pub async fn register_with_config<P>(
&self,
plugin: P,
config: PluginConfig,
) -> Result<(), Error>where
P: AgentPlugin + 'static,
使用配置注册插件
Sourcepub async fn get(
&self,
plugin_id: &str,
) -> Option<impl Deref<Target = Box<dyn AgentPlugin>>>
pub async fn get( &self, plugin_id: &str, ) -> Option<impl Deref<Target = Box<dyn AgentPlugin>>>
获取插件
Sourcepub async fn get_by_type(&self, plugin_type: PluginType) -> Vec<String>
pub async fn get_by_type(&self, plugin_type: PluginType) -> Vec<String>
获取指定类型的插件
Sourcepub async fn unload_all(&self) -> Result<(), Error>
pub async fn unload_all(&self) -> Result<(), Error>
卸载所有插件
Sourcepub async fn plugin_ids(&self) -> Vec<String>
pub async fn plugin_ids(&self) -> Vec<String>
获取所有插件 ID
Sourcepub async fn list_plugins(&self) -> Vec<PluginMetadata>
pub async fn list_plugins(&self) -> Vec<PluginMetadata>
获取所有插件元数据
Sourcepub async fn health_check_all(&self) -> HashMap<String, bool>
pub async fn health_check_all(&self) -> HashMap<String, bool>
健康检查所有插件
Sourcepub fn take_event_receiver(&mut self) -> Option<Receiver<PluginEvent>>
pub fn take_event_receiver(&mut self) -> Option<Receiver<PluginEvent>>
获取事件接收器
Auto Trait Implementations§
impl Freeze for PluginManager
impl !RefUnwindSafe for PluginManager
impl Send for PluginManager
impl Sync for PluginManager
impl Unpin for PluginManager
impl UnsafeUnpin for PluginManager
impl !UnwindSafe for PluginManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Message for T
impl<T> Message for T
Source§fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
Source§fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage