Skip to main content

RemoteComponent

Struct RemoteComponent 

Source
pub struct RemoteComponent {
    pub core: ComponentCore,
    pub client: Arc<JsonRpcClient>,
    pub kind: RemoteComponentKind,
    /* private fields */
}

Fields§

§core: ComponentCore

身份核心。内置插件与远程插件共享同一身份模型。

§client: Arc<JsonRpcClient>§kind: RemoteComponentKind

Implementations§

Source§

impl RemoteComponent

Source

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

Source

pub fn as_data_source(self: Arc<Self>) -> Option<Arc<dyn DataSource>>

将自身转换为 DataSource trait object,仅在 kind 为 DataSource 时成功。

Source

pub fn as_action_executor(self: Arc<Self>) -> Option<Arc<dyn ActionExecutor>>

将自身转换为 ActionExecutor trait object,仅在 kind 为 ActionExecutor 时成功。

Source

pub fn as_plugin(self: Arc<Self>) -> Option<Arc<dyn Plugin>>

将自身转换为 Plugin trait object,仅在 kind 为 Plugin 时成功。

Source

pub fn as_search_engine(self: Arc<Self>) -> Option<Arc<dyn SearchEngine>>

将自身转换为 SearchEngine trait object,仅在 kind 为 SearchEngine 时成功。

Source

pub fn as_score_booster(self: Arc<Self>) -> Option<Arc<dyn ScoreBooster>>

将自身转换为 ScoreBooster trait object,仅在 kind 为 ScoreBooster 时成功。

Source

pub fn as_keyword_optimizer( self: Arc<Self>, ) -> Option<Arc<dyn KeywordOptimizer>>

将自身转换为 KeywordOptimizer trait object,仅在 kind 为 KeywordOptimizer 时成功。

Source

pub fn as_keyword_injector(self: Arc<Self>) -> Option<Arc<dyn KeywordInjector>>

将自身转换为 KeywordInjector trait object,仅在 kind 为 KeywordInjector 时成功。

Source

pub fn is_data_source(&self) -> bool

Source

pub fn is_action_executor(&self) -> bool

Source

pub fn is_plugin(&self) -> bool

Source

pub fn is_search_engine(&self) -> bool

是否为搜索引擎组件。

Source

pub fn is_score_booster(&self) -> bool

是否为分数增强器组件。

Source

pub fn is_keyword_optimizer(&self) -> bool

是否为关键词优化器组件。

Source

pub fn is_keyword_injector(&self) -> bool

是否为关键词注入器组件。

Trait Implementations§

Source§

impl ActionExecutor for RemoteComponent

Source§

fn supported_target_types(&self) -> Vec<TargetType>

返回该 Executor 支持的目标类型集合
Source§

fn supported_actions(&self) -> Vec<ResultAction>

返回该 Executor 支持的动作列表
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,

根据动作 ID 执行对应的操作 参数:ctx - 执行上下文;action_id - 动作 ID 返回:执行成功返回 Ok(()),失败返回 ExecutionError
Source§

impl Configurable for RemoteComponent

Source§

fn default_enabled(&self) -> bool

默认启用状态来自插件自声明(discover 时经 RPC 拉取),与内置组件一致。

Source§

fn core(&self) -> &ComponentCore

返回组件身份核心。 Read more
Source§

fn setting_schema(&self) -> Vec<SettingDefinition>

返回组件的设置项 schema 定义列表。 Read more
Source§

fn get_settings(&self) -> Value

获取组件当前的配置值(JSON 格式)。
Source§

fn config_actions(&self) -> Vec<ConfigActionDef>

返回该组件支持的配置动作定义列表。 配置动作用于在设置面板中提供一键式辅助操作(如自动检测浏览器), 前端据此渲染操作按钮,用户点击后通过 execute_config_action 执行。
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,

应用配置到组件。 使用 &self 签名,组件内部通过 RwLock 等实现可变性。 async:远端插件(RemoteComponent)实现需经 RPC 下发配置到插件进程。
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,

校验一组配置值是否合法(不会实际应用)。 async:远端插件实现需经 RPC 委托插件进程补充业务校验。
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,

执行配置动作。 参数:action - 动作标识符,对应 ConfigActionDef.action。 params - 前端传递的附加参数(如书签文件路径)。 返回:动作执行结果(JSON 格式),由前端根据配置项类型解析并填充。
Source§

fn component_id(&self) -> &str

Source§

fn component_name(&self) -> &str

Source§

fn component_type(&self) -> ComponentType

Source§

fn priority(&self) -> u32

组件显示排序优先级,数值越小越靠前。
Source§

fn component_description(&self) -> &str

组件的功能描述文本,用于设置面板中向用户解释该组件的用途。
Source§

fn settings_contribution(&self) -> Result<SettingsContribution, ConfigError>

将 setting_schema() 的输出编译为 SettingsContribution。 Read more
Source§

fn get_default_settings(&self) -> Value

Source§

fn runtime_state(&self) -> Option<Value>

返回组件运行态快照(非用户配置:不写入 settings、不下发前端、不参与远端配置同步)。 Read more
Source§

fn restore_runtime_state(&self, state: Value)

从持久化的运行态恢复组件内部状态。 Read more
Source§

fn on_settings_changed(&self)

Source§

impl DataSource for RemoteComponent

Source§

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

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,

根据候选项的完整上下文注入额外关键字。 与 KeywordOptimizer 不同,此方法可以访问候选项的 target、icon 等完整信息, 用于实现“基于候选身份的关键字注入“(如别名)。
Source§

impl KeywordOptimizer for RemoteComponent

Source§

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,

Source§

fn input_source(&self) -> KeywordInputSource

Source§

fn get_priority(&self) -> u32

Source§

impl Plugin for RemoteComponent

Source§

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,

查询匹配:经 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,

插件初始化钩子。 Read more
Source§

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,

执行插件动作。 action_id 为插件在 ListItem.actions / CustomPanel.actions / 面板按键 绑定中声明的动作标识;payload 形状由触发通道决定(插件应两种都兼容): Read more
Source§

impl ScoreBooster for RemoteComponent

Source§

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,

Source§

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

Source§

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§

Blanket Implementations§

Source§

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
where 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) -> D
where M: TransformMatrix<T>,

👎Deprecated since 0.7.7:

replaced by palette::chromatic_adaptation::AdaptIntoUnclamped

Convert the source color to the destination color using the specified method.
Source§

fn adapt_into(self) -> D

👎Deprecated since 0.7.7:

replaced by palette::chromatic_adaptation::AdaptIntoUnclamped

Convert the source color to the destination color using the bradford method by default.
Source§

impl<T, C> AdaptIntoUnclamped<T> for C
where T: AdaptFromUnclamped<C>,

Source§

type Scalar = <T as AdaptFromUnclamped<C>>::Scalar

The number type that’s used as the color’s components.
Source§

fn adapt_into_unclamped_with<M>(self) -> T

Adapt a color of type Self into a color of type T, using the custom matrix M. Read more
Source§

fn adapt_into_unclamped(self) -> T
where Bradford: LmsToXyz<Self::Scalar> + XyzToLms<Self::Scalar>,

Adapt a color of type Self into a color of type T, using the Bradford matrix. Read more
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T, C> ArraysFrom<C> for T
where C: IntoArrays<T>,

Source§

fn arrays_from(colors: C) -> T

Cast a collection of colors into a collection of arrays.
Source§

impl<T, C> ArraysInto<C> for T
where C: FromArrays<T>,

Source§

fn arrays_into(self) -> C

Cast this collection of arrays into a collection of colors.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for U
where T: FromCam16Unclamped<WpParam, U>,

Source§

type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T, C> ComponentsFrom<C> for T
where C: IntoComponents<T>,

Source§

fn components_from(colors: C) -> T

Cast a collection of colors into a collection of color components.
Source§

impl<T, C> ComponentsInto<C> for T

Source§

fn components_into(self) -> C

Cast this collection of color components into a collection of colors. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromAngle<T> for T

Source§

fn from_angle(angle: T) -> T

Performs a conversion from angle.
Source§

impl<T, U> FromStimulus<U> for T
where U: IntoStimulus<T>,

Source§

fn from_stimulus(other: U) -> T

Converts other into Self, while performing the appropriate scaling, rounding and clamping.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> IntoAngle<U> for T
where U: FromAngle<T>,

Source§

fn into_angle(self) -> U

Performs a conversion into T.
Source§

impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for U
where T: Cam16FromUnclamped<WpParam, U>,

Source§

type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<T, U> IntoColor<U> for T
where U: FromColor<T>,

Source§

fn into_color(self) -> U

Convert into T with values clamped to the color defined bounds Read more
Source§

impl<T, U> IntoColorUnclamped<U> for T
where U: FromColorUnclamped<T>,

Source§

fn into_color_unclamped(self) -> U

Convert into T. The resulting color might be invalid in its color space Read more
Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> IntoStimulus<T> for T

Source§

fn into_stimulus(self) -> T

Converts self into T, while performing the appropriate scaling, rounding and clamping.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, C> TryComponentsInto<C> for T
where C: TryFromComponents<T>,

Source§

type Error = <C as TryFromComponents<T>>::Error

The error for when try_into_colors fails to cast.
Source§

fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>

Try to cast this collection of color components into a collection of colors. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T, U> TryIntoColor<U> for T
where U: TryFromColor<T>,

Source§

fn try_into_color(self) -> Result<U, OutOfBounds<U>>

Convert into T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more
Source§

impl<C, U> UintsFrom<C> for U
where C: IntoUints<U>,

Source§

fn uints_from(colors: C) -> U

Cast a collection of colors into a collection of unsigned integers.
Source§

impl<C, U> UintsInto<C> for U
where C: FromUints<U>,

Source§

fn uints_into(self) -> C

Cast this collection of unsigned integers into a collection of colors.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more