Struct rustdx::tcp::SecurityCount

source ·
pub struct SecurityCount { /* private fields */ }
Expand description

对应 pytdx 的 hq.security_count / GetSecurityCountCmd (深沪市证券数量,包括指数、股票和大量债券)、心跳包。

Implementations§

source§

impl SecurityCount

source

pub fn new(market: u16) -> Self

market = 0 或 1,表示深市或沪市。

source

pub fn market(&mut self, market: u16)

Trait Implementations§

source§

impl Debug for SecurityCount

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Tdx for SecurityCount

source§

const SEND: &'static [u8] = _

深市证券数量的请求字节。

§

type Item = u16

source§

const TAG: &'static str = "heartbeat"

描述此次 tcp 连接的用途,目前用于记录日志。
source§

fn send(&mut self) -> &[u8]

真正发送的字节。
source§

fn parse(&mut self, response: Vec<u8>)

解析响应的字节。
source§

fn result(&self) -> &Self::Item

解析后的结果。可以是引用,也可以是 owned type 。
source§

const LEN: usize = _

发送的字节的长度。每种请求所发送的字节长度是已知的。默认为 Tdx::SEND 的长度。
source§

fn recv(&mut self, tcp: &mut Tcp) -> Result<Vec<u8>>

得到响应的字节。响应的字节长度无法预测。
source§

fn recv_parsed(&mut self, tcp: &mut Tcp) -> Result<&Self::Item>

得到和解析响应的字节,并返回解析的数据。

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.