Skip to main content

Registry

Struct Registry 

Source
pub struct Registry {
    pub list: Vec<ModuleWin>,
}
Expand description

挂载表。

Fields§

§list: Vec<ModuleWin>

模块窗(按 order 排序后使用)。

Implementations§

Source§

impl Registry

Source

pub fn with_always() -> Self

只要 MODULES 里标了 always 的模块(交易网关 / 宿主自有窗)。

UiShared::new() 用它 —— 保证“没引擎、没装配“时这几扇窗也在菜单里 (先建账户档案再连接,是 CTP 的正常用法)。

Source

pub fn is_open(&self, kind: &str) -> bool

模块窗开合读。

Source

pub fn set_open(&mut self, kind: &str, open: bool)

模块窗开合写(always 模块不在册时先补建 —— 测试/启动器阶段无引擎也通)。

Source

pub fn mount(shared: &UiShared) -> Self

按引擎当前在册插件建挂载表(开机装配完成后调一次)。

Source

pub fn sync(&mut self, shared: &UiShared)

同步实例列表:插件增删后调(svctl.start/remove 回执处)。

语义:

  • 已有模块窗保留(开合、窗内编辑态都不丢),只更新 instances;
  • 新模块(首次出现)建窗并挂上;
  • 模块的实例全部摘掉 → 非 always 的窗下架。
Source

pub fn sync_groups(&mut self, groups: &BTreeMap<String, GroupInfo>)

只吃「按 kind 归好的实例表」的那一半(0.9.40)。

拆出来是为了让调用方在锁外做引擎扫描:旧写法持着挂载表锁去扫引擎, 而引擎在插件起停时会短暂持锁(装配 2~4 秒)—— 主界面点菜单就跟着卡死。

0.9.47:入参从 Vec<实例名> 换成 GroupInfo(多带一份插件自报的窗描述), 本方法仍然不碰引擎 —— 描述是 scan_groups 在锁外顺手取的。

Source

pub fn menu(&mut self, ui: &mut Ui, shared: &UiShared)

菜单区渲染:一项 = 一个模块(点谁开谁;再点置真,幂等)。

文字 = 模块标题本身(不带 emoji 前缀):菜单的可检索文本与模块名一一对应, 图标只进 tooltip —— 判据(含 kittest 按 label 取件)只认标题,不认装饰。

Source

pub fn windows(&mut self, ctx: &Context, shared: &UiShared)

窗口区渲染:开着的逐个开(都在独立 OS 窗;不支持多窗的后端走主窗内嵌)。

⚠ 重入纪律:本方法持着挂载表锁渲染整扇窗 —— 窗体内不许再调 UiShared::modules(Mutex 非重入,会自锁)。窗体内的开合要么走 UiShared 的老旗子(set_ops_window_open 等,纯原子位),要么等下一拍由 调用方处理。

Trait Implementations§

Source§

impl Debug for Registry

Source§

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

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

impl Default for Registry

Source§

fn default() -> Self

空表也是“合法表“:always 模块在 Registry::with_always 里补齐, Default 只给 #[derive(Default)] UiShared 用(测试无引擎时也不炸)。

Auto Trait Implementations§

Blanket Implementations§

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> 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<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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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> 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