pub struct StockPool<T> { /* private fields */ }Expand description
Design a high-performance stock pool, where all data is stored in arrays, and data is accessed via array indices; this index is converted from the stock code; 4 arrays, one for Shanghai Main Board stocks, one for Shenzhen Main Board stocks, one for ChiNext stocks; and one for STAR Market stocks; The length of each array is fixed, determined by the number of stocks in the A-share market; for example, if the number of Shanghai Main Board stocks is 1500, the array length is 1500;
设计一个高性能股票池, 数据全部以数组的形式存储, 通过数组的下标来获取数据; 此下标是股票代码转换而来; 4个数组, 一个存储上海主板股票, 一个存储深圳主板股票, 一个存储创业板股票; 还有一个数组存储科创板股票; 每个数组的长度是固定的, 都根据A股市场的股票数量来确定; 例如上海主板股票数量是1500, 则数组的长度是1500;
Implementations§
Source§impl<T: Default> StockPool<T>
impl<T: Default> StockPool<T>
Sourcepub fn new_default() -> StockPool<T>
pub fn new_default() -> StockPool<T>
Create a new StockPool with default values 创建一个带有默认值的 StockPool
Source§impl<T> StockPool<T>
impl<T> StockPool<T>
pub fn new_empty() -> StockPool<T>
Sourcepub fn is_empty(&self, i7: i32) -> bool
pub fn is_empty(&self, i7: i32) -> bool
Check if the item at the given index is empty 检查给定索引处的项目是否为空
Sourcepub fn get(&self, i7: i32) -> Option<&T>
pub fn get(&self, i7: i32) -> Option<&T>
获取股票数据; 股票代码是7位数字, 1开头说明是上海票, 2开头说明是深圳票; 其它6位数与常规股票代码一样;