df_hyperliquid_core/live/frame/reply.rs
1//! A post's answer, by the id it was sent with: what `/info` or `/exchange` would have answered,
2//! or what HTTP would have said when the post was not taken.
3
4use crate::client::ExchangeResponse;
5
6/// The answer to a post, by the id it was sent with.
7#[derive(Debug, Clone, PartialEq, Eq)]
8pub struct Reply {
9 /// The id the post was sent with.
10 pub id: u64,
11 /// What came back.
12 pub answer: Answer,
13}
14
15/// What came back for a post, by the `type` of the response.
16#[derive(Debug, Clone, PartialEq, Eq)]
17pub enum Answer {
18 /// What `/info` would have answered, as written (`null` for an unknown coin's book), for a
19 /// read's own type to deserialize.
20 Info {
21 /// The `type` of the info answer.
22 kind: String,
23 /// Its `data` as written JSON; `null` when the answer has none.
24 data: String,
25 },
26 /// What `/exchange` would have answered.
27 Action(ExchangeResponse),
28 /// The post was not taken: what HTTP would have said.
29 Error(String),
30}
31
32#[cfg(test)]
33#[path = "tests/reply.rs"]
34mod tests;