pub struct QotStockKey {
pub stock_id: u64,
pub broker_id: Option<NonZeroU32>,
}Expand description
QOT broker-aware stock 唯一识别.
对齐 C++ NNProtoCenter_Define_StockKey.h::StockKey:
stock_id= C++nStockIDbroker_id = Some(N)⟺ C++m_hasBroker = true && enBrokerID = Nbroker_id = None⟺ C++m_hasBroker = false
注意 broker_id 不接受 0 (C++ 语义: 0 = NN_BrokerID_Unknown = no-broker).
Fields§
§stock_id: u64§broker_id: Option<NonZeroU32>Implementations§
Source§impl QotStockKey
impl QotStockKey
Sourcepub fn with_broker(stock_id: u64, broker_id: u32) -> Option<Self>
pub fn with_broker(stock_id: u64, broker_id: u32) -> Option<Self>
带 broker 的 stock key (C++ StockKey(stockID, brokerID)).
broker_id = 0 不接受 (C++ NN_BrokerID_Unknown 走 no-broker path).
返 None 时, caller 应该改用 no_broker(stock_id).
Sourcepub fn from_broker_id_or_no_broker(stock_id: u64, broker_id: u32) -> Self
pub fn from_broker_id_or_no_broker(stock_id: u64, broker_id: u32) -> Self
从 u32 broker_id 安全构造 — 0 自动降级到 no-broker.
等价 C++ StockKey(stockID, brokerID == NN_BrokerID_Unknown ? no-broker : with broker).
Sourcepub fn has_broker(&self) -> bool
pub fn has_broker(&self) -> bool
C++ HasBroker() 等价.
Sourcepub fn broker_id_or_zero(&self) -> u32
pub fn broker_id_or_zero(&self) -> u32
C++ GetBrokerID() 等价 (返 raw u32, no-broker 返 0).
Trait Implementations§
Source§impl Clone for QotStockKey
impl Clone for QotStockKey
Source§fn clone(&self) -> QotStockKey
fn clone(&self) -> QotStockKey
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 QotStockKey
impl Debug for QotStockKey
Source§impl Display for QotStockKey
impl Display for QotStockKey
Source§impl Hash for QotStockKey
impl Hash for QotStockKey
Source§impl Ord for QotStockKey
impl Ord for QotStockKey
Source§fn cmp(&self, other: &QotStockKey) -> Ordering
fn cmp(&self, other: &QotStockKey) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for QotStockKey
impl PartialEq for QotStockKey
Source§impl PartialOrd for QotStockKey
impl PartialOrd for QotStockKey
impl Copy for QotStockKey
impl Eq for QotStockKey
impl StructuralPartialEq for QotStockKey
Auto Trait Implementations§
impl Freeze for QotStockKey
impl RefUnwindSafe for QotStockKey
impl Send for QotStockKey
impl Sync for QotStockKey
impl Unpin for QotStockKey
impl UnsafeUnpin for QotStockKey
impl UnwindSafe for QotStockKey
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