1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! Decoding `indicative_market_data` frames, batched or not.
//!
//! [`crate::WsClient::subscribe_indicative_market_data`] subscribes to
//! `indicative_market_data_v2`, whose `IndicativeMarketDataBatch` frames each
//! hold several rows oldest first. With batching disabled, or against a server
//! that predates the v2 channel, it uses `indicative_market_data`, where each
//! row arrives as its own `IndicativeMarketData` frame. The helpers here return the rows in delivery order either way, so
//! applying them in order gives the same per-instrument state regardless of
//! framing.
//!
//! ```rust
//! use hypercall_client::indicative::decode_indicative_rows;
//!
//! let frame = r#"{"type":"IndicativeMarketDataBatch","flushed_at":2,"updates":[
//! {"instrument":"BTC-20261002-87000-C","best_bid":"14.79","best_ask":"133.88",
//! "num_providers":1,"published_at":1,"timestamp":1}]}"#;
//! let rows = decode_indicative_rows(frame).unwrap().expect("indicative frame");
//! assert_eq!(rows[0].instrument, "BTC-20261002-87000-C");
//! ```
use crateResult;
use ;
/// Rows carried by one server message, or `None` if it is not indicative
/// market data.
/// Decode one text frame and return its indicative rows, or `None` for any
/// other message type.
///
/// Frames come from the network, so they are decoded with Serde, whose
/// default recursion limit rejects hostile nesting (the repository JSON
/// policy: Serde incoming, Sonic outgoing).
/// [`decode_indicative_rows`] for a message already collected by
/// [`crate::WsClient`] (see [`crate::WsClient::get_messages`]).