pub struct UiShared { /* private fields */ }Expand description
插件面板与宿主观察线程共用的观测状态。
Implementations§
Sourcepub fn update_tick(&self, t: &TickData)
pub fn update_tick(&self, t: &TickData)
落一条 tick(eTick. 裸键上屏;逐 symbol 覆盖)。
Sourcepub fn tick_count(&self) -> usize
pub fn tick_count(&self) -> usize
tick 库格数。
Sourcepub fn order_form(&self) -> OrderForm
pub fn order_form(&self) -> OrderForm
下单表单只读快照。
Sourcepub fn set_order_form(&self, f: OrderForm)
pub fn set_order_form(&self, f: OrderForm)
下单表单写(渲染侧每控件改动即写)。
Sourcepub fn selected_exchange(&self) -> String
pub fn selected_exchange(&self) -> String
选中交易所(行情二级 tab 态;行情行单击 = 带入下单面板见 render 侧)。
Sourcepub fn set_selected_exchange(&self, s: impl Into<String>)
pub fn set_selected_exchange(&self, s: impl Into<String>)
选中交易所写。
Sourcepub fn topleft_tab(&self) -> TopLeftTab
pub fn topleft_tab(&self) -> TopLeftTab
左上组当前 tab。
Sourcepub fn set_topleft_tab(&self, t: TopLeftTab)
pub fn set_topleft_tab(&self, t: TopLeftTab)
左上组 tab 写。
Sourcepub fn bottomright_tab(&self) -> BottomRightTab
pub fn bottomright_tab(&self) -> BottomRightTab
右下组当前 tab。
Sourcepub fn set_bottomright_tab(&self, t: BottomRightTab)
pub fn set_bottomright_tab(&self, t: BottomRightTab)
右下组 tab 写。
Sourcepub fn cycle_theme(&self) -> Theme
pub fn cycle_theme(&self) -> Theme
菜单钮一键循环:切到下一主题并返回。
Sourcepub fn ops_window_open(&self) -> bool
pub fn ops_window_open(&self) -> bool
运维窗开合。
Sourcepub fn set_ops_window_open(&self, v: bool)
pub fn set_ops_window_open(&self, v: bool)
运维窗开合写。
Sourcepub fn accounts_window_open(&self) -> bool
pub fn accounts_window_open(&self) -> bool
账户面板开合。
Sourcepub fn set_accounts_window_open(&self, v: bool)
pub fn set_accounts_window_open(&self, v: bool)
账户面板开合写。
Sourcepub fn account_edit_open(&self) -> bool
pub fn account_edit_open(&self) -> bool
账户配置弹窗开合(0.2.18 Commit B)。
Sourcepub fn editing_account(&self) -> Option<String>
pub fn editing_account(&self) -> Option<String>
当前弹窗模式:Some(派生名) = 编辑;None = 添加。
Sourcepub fn begin_account_edit(&self, gateway: Option<&str>) -> bool
pub fn begin_account_edit(&self, gateway: Option<&str>) -> bool
打开配置弹窗并载入草稿:Some(派生名) = 编辑模式(草稿 = 该账户留档);
None = 添加模式(草稿 = draft_from_existing(),凭据位空)。
账户不在清册 = false(不开一个编辑不存在账户的窗)。
Sourcepub fn end_account_edit(&self)
pub fn end_account_edit(&self)
关闭配置弹窗 = 放弃未保存(规划 Q24:绝不静默写入清册留档)。
Sourcepub fn end_account_edit_if_editing(&self, gateway: &str)
pub fn end_account_edit_if_editing(&self, gateway: &str)
摘除一行账户时的连带口径:若这行正被配置弹窗编辑,立即关弹窗放弃。
不这么做的话:弹窗是非 modal 的,用户可以在弹窗开着时点同一行的『移除』—— 编辑目标消失后弹窗会静默退化成「添加模式」(只读句消失、字段全部可编辑), 此时点『保存』会拿旧凭据建出一个新账户。这是执行核查抓到的坑。
Sourcepub fn edit_alias(&self) -> String
pub fn edit_alias(&self) -> String
弹窗别名草稿读。
Sourcepub fn set_edit_alias(&self, v: impl Into<String>)
pub fn set_edit_alias(&self, v: impl Into<String>)
弹窗别名草稿写。
Sourcepub fn edit_error(&self) -> Option<String>
pub fn edit_error(&self) -> Option<String>
弹窗拦截原因读(None = 无)。
Sourcepub fn set_edit_error(&self, e: Option<String>)
pub fn set_edit_error(&self, e: Option<String>)
弹窗拦截原因写(None = 清)。
Sourcepub fn account_edit_dirty(&self) -> bool
pub fn account_edit_dirty(&self) -> bool
弹窗草稿与该账户留档是否不一致(dirty;添加模式恒为“有内容待保存“)。
Sourcepub fn accounts(&self) -> Vec<AccountRow>
pub fn accounts(&self) -> Vec<AccountRow>
账户清单只读视图(注册序)。
Sourcepub fn account(&self, gateway: &str) -> Option<AccountRow>
pub fn account(&self, gateway: &str) -> Option<AccountRow>
单行账户查询。
Sourcepub fn add_account(&self, row: AccountRow) -> Result<(), String>
pub fn add_account(&self, row: AccountRow) -> Result<(), String>
新增一行账户(只写清册,不装配 —— 规划裁定「添加 ≠ 连接」)。
Err(原因) 三种:派生名已存在(同 broker+账号重复添加)、别名重名(规划 Q3)、
达账户软上限 MAX_ACCOUNTS。宿主侧还有第二道 Duplicate 守卫;界面侧先拦是为了
不建出一个“注定被拒“的请求。
Sourcepub fn can_add_account(&self) -> bool
pub fn can_add_account(&self) -> bool
是否还能添加账户。
Sourcepub fn set_account_alias(&self, gateway: &str, alias: &str) -> bool
pub fn set_account_alias(&self, gateway: &str, alias: &str) -> bool
改一行账户的别名(按 gateway 主键;不存在 = false)。
别名只用于显示与选择,不参与寻址(寻址恒用派生注册名,规划 Q3)。
别名须唯一(与 add_account 同一守卫):空别名 = 不设别名(合法);
与他人重名 = false(调用方须显形,不得静默改成重名别名)。
Sourcepub fn note_connect_sent(&self, gateway: &str)
pub fn note_connect_sent(&self, gateway: &str)
UiCmd::Connect 已入列 → 四态置「装配中」并清掉上一次的失败原因。
Sourcepub fn note_connect_result(&self, gateway: &str, result: Result<(), String>)
pub fn note_connect_result(&self, gateway: &str, result: Result<(), String>)
装配结果回写:Ok(()) → 「实例已装配」;Err(原因) → 「装配失败」+ 原因留显形。
失败不回滚清册行(规划 U3 定盘:行留着,给『重试』;旧口径“必须先移除才能重试“作废)。
Sourcepub fn note_effective_product_classes(&self, gateway: &str, classes: &[String])
pub fn note_effective_product_classes(&self, gateway: &str, classes: &[String])
记录网关实际收录的产品类(ConfigureReply.product_classes 回带,规划 U9)。
只存不改用户勾选:勾选是意图,这一栏是事实,两者并排显示。
Sourcepub fn prepare_connect_form(&self, gateway: &str, form: CtpForm) -> CtpForm
pub fn prepare_connect_form(&self, gateway: &str, form: CtpForm) -> CtpForm
装配前把表单落到该账户留档,并按全局单源纪律裁决 md 位:
非行情源账户 → md_addr 就地清空(留档与下发同一份,消 U4 的“只清下发不清留档“)。
Sourcepub fn draft_from_existing(&self) -> CtpForm
pub fn draft_from_existing(&self) -> CtpForm
『添加账户』弹窗的草稿位:沿用当前在场账户的非凭据字段 (broker / AppID / AuthCode / 收录勾选),凭据位(账号、密码、前置)一律清空 (规划 Q20 的零风险缓解:少敲几遍,但绝不把上一家的密码带进下一家)。
Sourcepub fn update_account_form(&self, gateway: &str, form: CtpForm) -> bool
pub fn update_account_form(&self, gateway: &str, form: CtpForm) -> bool
更新一行账户的表单留档(按 gateway 主键;不存在 = false)。
Sourcepub fn remove_account(&self, gateway: &str) -> bool
pub fn remove_account(&self, gateway: &str) -> bool
摘除一行账户(界面侧清册;网关实例由 UiCmd::Remove 走 svctl 摘)。
Sourcepub fn sync_accounts_connected(&self, rows: &[PlugRow]) -> Vec<String>
pub fn sync_accounts_connected(&self, rows: &[PlugRow]) -> Vec<String>
用 svctl 快照回填账户在场位与四态;回带本轮新装配的网关名(订阅重放用)。
四态口径:svctl 带回这个名字 = 实例已装配(清掉失败原因); 名字不在场且原先记着「已装配」= 回到「未装配」(被摘/宿主崩了); 「装配中」与「装配失败」是界面侧记的,不被在场表覆盖。
Sourcepub fn accounts_locked(&self) -> bool
pub fn accounts_locked(&self) -> bool
是否已有账户装配 —— 元账号锁定判定(规划 D3:连接后不允许切换)。
Sourcepub fn set_md_source(&self, gateway: &str) -> Result<(), String>
pub fn set_md_source(&self, gateway: &str) -> Result<(), String>
指定行情元账号(仅配置阶段;任何账户已连接 = 拒,界面须提示“先断开“)。
Sourcepub fn subscriptions(&self) -> Vec<String>
pub fn subscriptions(&self) -> Vec<String>
订阅集只读视图。
Sourcepub fn note_subscriptions(&self, symbols: &[String])
pub fn note_subscriptions(&self, symbols: &[String])
登记订阅(去重保序;断开重连后按它重放)。
Sourcepub fn default_gateway(&self) -> Option<String>
pub fn default_gateway(&self) -> Option<String>
下单默认账户阶梯(替代旧“空 → 字面量 ctp“兜底,规划 §5.B;
0.2.18 四态后修正,规划 Q4):
上次手动选择(须仍在清册且已装配)→ 第一个已装配账户;
未装配账户不得进默认 —— 旧阶梯的“退到第一个账户“会把只添加了还没连接的
账户选成下单归属,发出去只会撞 unknown:gateway。
一个都没有 = None(界面据此禁用下单钮)。
Sourcepub fn kline_symbols(&self) -> Vec<String>
pub fn kline_symbols(&self) -> Vec<String>
已开 K线窗合约表(多开,去重)。
Sourcepub fn open_kline(&self, symbol: impl Into<String>)
pub fn open_kline(&self, symbol: impl Into<String>)
开 K线窗(去重;日志留痕可断言)。
Sourcepub fn close_kline(&self, symbol: &str)
pub fn close_kline(&self, symbol: &str)
关 K线窗(窗关闭钮 → 出表)。
Sourcepub fn contracts_window_open(&self) -> bool
pub fn contracts_window_open(&self) -> bool
查询合约窗开合。
Sourcepub fn set_contracts_window_open(&self, v: bool)
pub fn set_contracts_window_open(&self, v: bool)
查询合约窗开合写。
Sourcepub fn update_contract(&self, c: &ContractData)
pub fn update_contract(&self, c: &ContractData)
落一条合约(eContract. 裸键上屏)。
Sourcepub fn contracts(&self, pattern: &str) -> Vec<ContractData>
pub fn contracts(&self, pattern: &str) -> Vec<ContractData>
合约查询(Python ContractManager 口径:留空 = 全部)。
Sourcepub fn contract_count(&self) -> usize
pub fn contract_count(&self) -> usize
合约库格数。
Sourcepub fn contract_query(&self) -> String
pub fn contract_query(&self) -> String
查询串读写。
Sourcepub fn set_contract_query(&self, q: impl Into<String>)
pub fn set_contract_query(&self, q: impl Into<String>)
查询串写。
Sourcepub fn toggle_contract_selection(&self, en_symbol: &str)
pub fn toggle_contract_selection(&self, en_symbol: &str)
勾选翻转(en_symbol)。
Sourcepub fn selected_contracts(&self) -> Vec<String>
pub fn selected_contracts(&self) -> Vec<String>
当前勾选集。
Sourcepub fn clear_logs(&self)
pub fn clear_logs(&self)
清空日志(渲染“清空日志“按钮 / 测试)。
Sourcepub fn logs_snapshot(&self) -> (Vec<String>, u64)
pub fn logs_snapshot(&self) -> (Vec<String>, u64)
日志只读快照 + 溢出计数。
Sourcepub fn set_snapshot(&self, snap: BusSnap)
pub fn set_snapshot(&self, snap: BusSnap)
落一次服务快照(eTimer 节流回调)。
Sourcepub fn request_stop(&self)
pub fn request_stop(&self)
置关窗信号(eframe App 关窗钩子调用)。
Sourcepub fn drain_cmds(&self) -> Vec<UiCmd>
pub fn drain_cmds(&self) -> Vec<UiCmd>
取走全部指令(eTimer 节拍辞行)。
Sourcepub fn pending_confirm(&self) -> Option<String>
pub fn pending_confirm(&self) -> Option<String>
当前待二次确认目标(Some = 二次确认中)。
Sourcepub fn confirm_step(&self, name: &str) -> ConfirmStep
pub fn confirm_step(&self, name: &str) -> ConfirmStep
确认步进:同名二点 = 发令(Fired),异名 = 迁移(Switched),首点 = 进入待确认。
Sourcepub fn confirm_cancel(&self)
pub fn confirm_cancel(&self)
清除待确认(取消钮)。
Sourcepub fn market(&self) -> &MarketStore
pub fn market(&self) -> &MarketStore
行情库直读(读写两用:worker 写,渲染读)。
Sourcepub fn set_trade_snap(&self, ts: TradeSnap)
pub fn set_trade_snap(&self, ts: TradeSnap)
交易监控快照写(ui 插件 eTimer 拍)。
Sourcepub fn trade_snap(&self) -> Arc<TradeSnap> ⓘ
pub fn trade_snap(&self) -> Arc<TradeSnap> ⓘ
交易监控快照读(渲染)。
Sourcepub fn set_ctp_form(&self, f: CtpForm)
pub fn set_ctp_form(&self, f: CtpForm)
CTP 配置表单写。
Sourcepub fn row_selected(&self, table: &str, key: &str) -> bool
pub fn row_selected(&self, table: &str, key: &str) -> bool
该行是否为所属表的选中行(渲染判断;无键 = 未选)。
Sourcepub fn select_row(&self, table: &str, key: &str)
pub fn select_row(&self, table: &str, key: &str)
设所属表的选中行(每表一行;同键重复点 = 保持)。
Trait Implementations§
Auto Trait Implementations§
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
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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.