pub struct FundsCacheKey {
pub acc_id: u64,
pub asset_category: i32,
pub currency: Option<i32>,
}Expand description
v1.4.106 Finding A (codex source audit 2026-05-01): funds cache currency-aware key.
对齐 C++ INNData_Trd_Acc.cpp::m_mapAccFund:
m_mapAccFund: NN_AssetKey -> NN_TrdCurrency -> Ndt_Trd_AccFund
Universal/Futures 账户对不同 currency 有独立 funds snapshot, 之前 Rust
用 DashMap<AccKey, CachedFunds> (1 acc_id → 1 snapshot) 会被 backend
pushed snapshots 互相覆盖 — 用户传 currency=USD 拿到的可能是 stale
CAD 数据, 客户端无法察觉.
字段语义:
acc_id: 账户 (主 key)asset_category:Trd_Common.proto::AssetCategoryenum (0=Default 等), 对齐 C++ NN_AssetKey 子集. 若 client 传c2s.asset_category=None, 用 0.currency:Some(c)表示 per-currency snapshot (Futures/Universal 路径);None表示 legacy 单币种账户 native (无 per-currency 概念). C++ 等价于 “first available currency” snapshot.
Fields§
§acc_id: u64§asset_category: i32§currency: Option<i32>Implementations§
Source§impl FundsCacheKey
impl FundsCacheKey
Sourcepub const fn legacy(acc_id: u64) -> Self
pub const fn legacy(acc_id: u64) -> Self
Legacy single-account snapshot key (acc_id only, no per-currency / no per-asset_category dimension). 用于 SingleCurrency 账户 / 无 currency context 的 cache write.
Sourcepub const fn per_currency(acc_id: u64, currency: i32) -> Self
pub const fn per_currency(acc_id: u64, currency: i32) -> Self
Per-currency snapshot key (Universal/Futures 路径).
Trait Implementations§
Source§impl Clone for FundsCacheKey
impl Clone for FundsCacheKey
Source§fn clone(&self) -> FundsCacheKey
fn clone(&self) -> FundsCacheKey
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FundsCacheKey
impl Debug for FundsCacheKey
Source§impl Hash for FundsCacheKey
impl Hash for FundsCacheKey
Source§impl PartialEq for FundsCacheKey
impl PartialEq for FundsCacheKey
impl Copy for FundsCacheKey
impl Eq for FundsCacheKey
impl StructuralPartialEq for FundsCacheKey
Auto Trait Implementations§
impl Freeze for FundsCacheKey
impl RefUnwindSafe for FundsCacheKey
impl Send for FundsCacheKey
impl Sync for FundsCacheKey
impl Unpin for FundsCacheKey
impl UnsafeUnpin for FundsCacheKey
impl UnwindSafe for FundsCacheKey
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more