pub struct RemoteComponent {
pub core: ComponentCore,
pub client: Arc<JsonRpcClient>,
pub kind: RemoteComponentKind,
/* private fields */
}Fields§
§core: ComponentCore身份核心。内置插件与远程插件共享同一身份模型。
client: Arc<JsonRpcClient>§kind: RemoteComponentKindImplementations§
Source§impl RemoteComponent
impl RemoteComponent
pub fn new( component_id: String, component_name: String, component_description: String, component_type: ComponentType, priority: u32, client: Arc<JsonRpcClient>, schema: Vec<SettingDefinition>, settings: Value, actions: Vec<ConfigActionDef>, default_enabled: bool, kind: RemoteComponentKind, ) -> Self
Sourcepub fn as_data_source(self: Arc<Self>) -> Option<Arc<dyn DataSource>>
pub fn as_data_source(self: Arc<Self>) -> Option<Arc<dyn DataSource>>
将自身转换为 DataSource trait object,仅在 kind 为 DataSource 时成功。
Sourcepub fn as_action_executor(self: Arc<Self>) -> Option<Arc<dyn ActionExecutor>>
pub fn as_action_executor(self: Arc<Self>) -> Option<Arc<dyn ActionExecutor>>
将自身转换为 ActionExecutor trait object,仅在 kind 为 ActionExecutor 时成功。
Sourcepub fn as_plugin(self: Arc<Self>) -> Option<Arc<dyn Plugin>>
pub fn as_plugin(self: Arc<Self>) -> Option<Arc<dyn Plugin>>
将自身转换为 Plugin trait object,仅在 kind 为 Plugin 时成功。
Sourcepub fn as_search_engine(self: Arc<Self>) -> Option<Arc<dyn SearchEngine>>
pub fn as_search_engine(self: Arc<Self>) -> Option<Arc<dyn SearchEngine>>
将自身转换为 SearchEngine trait object,仅在 kind 为 SearchEngine 时成功。
Sourcepub fn as_score_booster(self: Arc<Self>) -> Option<Arc<dyn ScoreBooster>>
pub fn as_score_booster(self: Arc<Self>) -> Option<Arc<dyn ScoreBooster>>
将自身转换为 ScoreBooster trait object,仅在 kind 为 ScoreBooster 时成功。
Sourcepub fn as_keyword_optimizer(
self: Arc<Self>,
) -> Option<Arc<dyn KeywordOptimizer>>
pub fn as_keyword_optimizer( self: Arc<Self>, ) -> Option<Arc<dyn KeywordOptimizer>>
将自身转换为 KeywordOptimizer trait object,仅在 kind 为 KeywordOptimizer 时成功。
Sourcepub fn as_keyword_injector(self: Arc<Self>) -> Option<Arc<dyn KeywordInjector>>
pub fn as_keyword_injector(self: Arc<Self>) -> Option<Arc<dyn KeywordInjector>>
将自身转换为 KeywordInjector trait object,仅在 kind 为 KeywordInjector 时成功。
pub fn is_data_source(&self) -> bool
pub fn is_action_executor(&self) -> bool
pub fn is_plugin(&self) -> bool
Sourcepub fn is_search_engine(&self) -> bool
pub fn is_search_engine(&self) -> bool
是否为搜索引擎组件。
Sourcepub fn is_score_booster(&self) -> bool
pub fn is_score_booster(&self) -> bool
是否为分数增强器组件。
Sourcepub fn is_keyword_optimizer(&self) -> bool
pub fn is_keyword_optimizer(&self) -> bool
是否为关键词优化器组件。
Sourcepub fn is_keyword_injector(&self) -> bool
pub fn is_keyword_injector(&self) -> bool
是否为关键词注入器组件。
Trait Implementations§
Source§impl ActionExecutor for RemoteComponent
impl ActionExecutor for RemoteComponent
Source§fn supported_target_types(&self) -> Vec<TargetType>
fn supported_target_types(&self) -> Vec<TargetType>
Source§fn supported_actions(&self) -> Vec<ResultAction>
fn supported_actions(&self) -> Vec<ResultAction>
Source§fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 ExecutionContext,
action_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), ExecutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 ExecutionContext,
action_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), ExecutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§impl Configurable for RemoteComponent
impl Configurable for RemoteComponent
Source§fn default_enabled(&self) -> bool
fn default_enabled(&self) -> bool
默认启用状态来自插件自声明(discover 时经 RPC 拉取),与内置组件一致。
Source§fn core(&self) -> &ComponentCore
fn core(&self) -> &ComponentCore
Source§fn setting_schema(&self) -> Vec<SettingDefinition>
fn setting_schema(&self) -> Vec<SettingDefinition>
Source§fn get_settings(&self) -> Value
fn get_settings(&self) -> Value
Source§fn config_actions(&self) -> Vec<ConfigActionDef>
fn config_actions(&self) -> Vec<ConfigActionDef>
Source§fn apply_settings<'life0, 'async_trait>(
&'life0 self,
settings: Value,
) -> Pin<Box<dyn Future<Output = Result<(), ConfigError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn apply_settings<'life0, 'async_trait>(
&'life0 self,
settings: Value,
) -> Pin<Box<dyn Future<Output = Result<(), ConfigError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn validate_settings<'life0, 'life1, 'async_trait>(
&'life0 self,
settings: &'life1 Value,
) -> Pin<Box<dyn Future<Output = Result<(), ConfigError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn validate_settings<'life0, 'life1, 'async_trait>(
&'life0 self,
settings: &'life1 Value,
) -> Pin<Box<dyn Future<Output = Result<(), ConfigError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn execute_config_action<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
action: &'life1 str,
params: &'life2 Value,
) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn execute_config_action<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
action: &'life1 str,
params: &'life2 Value,
) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn component_id(&self) -> &str
fn component_name(&self) -> &str
fn component_type(&self) -> ComponentType
Source§fn component_description(&self) -> &str
fn component_description(&self) -> &str
Source§fn settings_contribution(&self) -> Result<SettingsContribution, ConfigError>
fn settings_contribution(&self) -> Result<SettingsContribution, ConfigError>
fn get_default_settings(&self) -> Value
Source§fn runtime_state(&self) -> Option<Value>
fn runtime_state(&self) -> Option<Value>
Source§fn restore_runtime_state(&self, state: Value)
fn restore_runtime_state(&self, state: Value)
fn on_settings_changed(&self)
Source§impl DataSource for RemoteComponent
impl DataSource for RemoteComponent
fn fetch_candidates<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CachedCandidateData> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl Debug for RemoteComponent
impl Debug for RemoteComponent
Source§impl KeywordInjector for RemoteComponent
impl KeywordInjector for RemoteComponent
Source§fn inject_keywords<'life0, 'life1, 'async_trait>(
&'life0 self,
candidate: &'life1 SearchCandidate,
) -> Pin<Box<dyn Future<Output = Vec<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn inject_keywords<'life0, 'life1, 'async_trait>(
&'life0 self,
candidate: &'life1 SearchCandidate,
) -> Pin<Box<dyn Future<Output = Vec<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl KeywordOptimizer for RemoteComponent
impl KeywordOptimizer for RemoteComponent
fn optimize<'life0, 'life1, 'async_trait>(
&'life0 self,
keyword: &'life1 str,
) -> Pin<Box<dyn Future<Output = Vec<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn input_source(&self) -> KeywordInputSource
fn get_priority(&self) -> u32
Source§impl Plugin for RemoteComponent
impl Plugin for RemoteComponent
Source§fn interaction_policy(&self) -> PanelInteraction
fn interaction_policy(&self) -> PanelInteraction
交互策略:返回查询时刷新的缓存值(与内置每次查询同步求值语义对齐)。 仅 Plugin 组件有策略(kind 已断言为 Plugin)。
Source§fn match_query<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
raw_query: &'life1 str,
declared_trigger_keywords: &'life2 [String],
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn match_query<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
raw_query: &'life1 str,
declared_trigger_keywords: &'life2 [String],
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
查询匹配:经 RPC 询问插件是否接管当前输入(响应为布尔值)。
超时故意远小于常规 5s 约定——本方法在按键热路径上执行,慢判定直接等于输入延迟。
- 旧 SDK 未实现该方法(
METHOD_NOT_FOUND)→ 用同一份框架关键词判定兜底(与改动前行为一致); - 其他错误/超时 → 按不命中处理并告警,不阻塞输入。
Source§fn init<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 PluginContext,
_handle: Option<Arc<PluginHandle>>,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn init<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 PluginContext,
_handle: Option<Arc<PluginHandle>>,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn query<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 PluginContext,
query: &'life2 Query,
) -> Pin<Box<dyn Future<Output = Result<QueryResponse, PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn execute_action<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 PluginContext,
action_id: &'life2 str,
payload: Value,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn execute_action<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 PluginContext,
action_id: &'life2 str,
payload: Value,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
action_id 为插件在 ListItem.actions / CustomPanel.actions / 面板按键
绑定中声明的动作标识;payload 形状由触发通道决定(插件应两种都兼容): Read moreSource§impl ScoreBooster for RemoteComponent
impl ScoreBooster for RemoteComponent
fn record<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
candidate_id: CandidateId,
data: &'life1 CachedCandidateData,
query: &'life2 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn boost<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
candidates: &'life1 mut Vec<ScoredCandidate>,
data: &'life2 CachedCandidateData,
query: &'life3 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Source§impl SearchEngine for RemoteComponent
impl SearchEngine for RemoteComponent
fn calculate_scores<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
candidates: &'life1 CachedCandidateData,
query: &'life2 str,
) -> Pin<Box<dyn Future<Output = Vec<ScoredCandidate>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Auto Trait Implementations§
impl !Freeze for RemoteComponent
impl !RefUnwindSafe for RemoteComponent
impl !UnwindSafe for RemoteComponent
impl Send for RemoteComponent
impl Sync for RemoteComponent
impl Unpin for RemoteComponent
impl UnsafeUnpin for RemoteComponent
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
replaced by palette::chromatic_adaptation::AdaptIntoUnclamped
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
replaced by palette::chromatic_adaptation::AdaptIntoUnclamped
Source§impl<T, C> AdaptIntoUnclamped<T> for Cwhere
T: AdaptFromUnclamped<C>,
impl<T, C> AdaptIntoUnclamped<T> for Cwhere
T: AdaptFromUnclamped<C>,
Source§type Scalar = <T as AdaptFromUnclamped<C>>::Scalar
type Scalar = <T as AdaptFromUnclamped<C>>::Scalar
Source§fn adapt_into_unclamped_with<M>(self) -> Twhere
M: LmsToXyz<<C as AdaptIntoUnclamped<T>>::Scalar> + XyzToLms<<C as AdaptIntoUnclamped<T>>::Scalar>,
fn adapt_into_unclamped_with<M>(self) -> Twhere
M: LmsToXyz<<C as AdaptIntoUnclamped<T>>::Scalar> + XyzToLms<<C as AdaptIntoUnclamped<T>>::Scalar>,
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
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
Source§impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
Source§impl<T, C> ComponentsInto<C> for T
impl<T, C> ComponentsInto<C> for T
Source§fn components_into(self) -> C
fn components_into(self) -> C
Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other into Self, while performing the appropriate scaling,
rounding and clamping.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, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
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> ⓘ
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> ⓘ
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> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self into T, while performing the appropriate scaling,
rounding and clamping.Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains
the unclamped color. Read more