pub struct Registry {
pub list: Vec<ModuleWin>,
}Expand description
挂载表。
Fields§
§list: Vec<ModuleWin>模块窗(按 order 排序后使用)。
Implementations§
Source§impl Registry
impl Registry
Sourcepub fn with_always() -> Self
pub fn with_always() -> Self
只要 MODULES 里标了 always 的模块(交易网关 / 宿主自有窗)。
UiShared::new() 用它 —— 保证“没引擎、没装配“时这几扇窗也在菜单里
(先建账户档案再连接,是 CTP 的正常用法)。
Sourcepub fn sync(&mut self, shared: &UiShared)
pub fn sync(&mut self, shared: &UiShared)
同步实例列表:插件增删后调(svctl.start/remove 回执处)。
语义:
- 已有模块窗保留(开合、窗内编辑态都不丢),只更新
instances; - 新模块(首次出现)建窗并挂上;
- 模块的实例全部摘掉 → 非
always的窗下架。
Sourcepub fn sync_groups(&mut self, groups: &BTreeMap<String, GroupInfo>)
pub fn sync_groups(&mut self, groups: &BTreeMap<String, GroupInfo>)
只吃「按 kind 归好的实例表」的那一半(0.9.40)。
拆出来是为了让调用方在锁外做引擎扫描:旧写法持着挂载表锁去扫引擎, 而引擎在插件起停时会短暂持锁(装配 2~4 秒)—— 主界面点菜单就跟着卡死。
0.9.47:入参从 Vec<实例名> 换成 GroupInfo(多带一份插件自报的窗描述),
本方法仍然不碰引擎 —— 描述是 scan_groups 在锁外顺手取的。
菜单区渲染:一项 = 一个模块(点谁开谁;再点置真,幂等)。
文字 = 模块标题本身(不带 emoji 前缀):菜单的可检索文本与模块名一一对应, 图标只进 tooltip —— 判据(含 kittest 按 label 取件)只认标题,不认装饰。
Sourcepub fn windows(&mut self, ctx: &Context, shared: &UiShared)
pub fn windows(&mut self, ctx: &Context, shared: &UiShared)
窗口区渲染:开着的逐个开(都在独立 OS 窗;不支持多窗的后端走主窗内嵌)。
⚠ 重入纪律:本方法持着挂载表锁渲染整扇窗 —— 窗体内不许再调
UiShared::modules(Mutex 非重入,会自锁)。窗体内的开合要么走
UiShared 的老旗子(set_ops_window_open 等,纯原子位),要么等下一拍由
调用方处理。
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Registry
impl RefUnwindSafe for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl UnsafeUnpin for Registry
impl UnwindSafe for Registry
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
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>
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)
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)
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.