financial-api 0.4.1

Rust client for the official Tonghuashun Financial Data REST API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use serde::{Deserialize, Serialize};

/// 保留源数字且不转换为二进制浮点数的 JSON 十进制数。
#[derive(
    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, derive_more::Display, derive_more::From,
)]
#[serde(transparent)]
#[display("{_0}")]
pub struct PreciseDecimal(serde_json::Number);

impl PreciseDecimal {
    /// 借用无损 JSON 数字表示。
    #[must_use]
    pub const fn as_number(&self) -> &serde_json::Number {
        &self.0
    }
}