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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
//! # polyoxide-venue
//!
//! The vocabulary every polyoxide crate shares, whichever venue it talks to.
//!
//! - [`Class`] sorts every failure into one of eight classes, and [`Classify`],
//! implemented by every public error type in the workspace, reports an
//! error's class, whether it is a fault, and how long the server asked the
//! caller to wait. [`ClassifiedError`] carries any of them.
//! - [`class_for_status`], [`class_for_close_code`] and
//! [`class_for_handshake_status`] are the one status and close-code table,
//! and [`impl_ws_classification!`] expands the one socket table for
//! `polyoxide_ws::WsError` in the venue crate that wraps it.
//! - [`parse_retry_after`] is the one `Retry-After` parser, and
//! [`retry_delay`] lets it only lengthen the client's own backoff.
//! - [`Secret`] holds a value its `Debug` never prints, and [`UnixMillis`] is
//! the time venues stamp things with.
//! - [`wire_enum!`] and [`open_enum!`] declare an enum whose variants each have
//! one wire spelling; a closed one refuses an unknown spelling with
//! [`UnknownVariant`], and an open one keeps it in `Other`.
//! [`specta_as_string!`] gives open enums their `specta` shape.
//! - With the `decimal` feature, `positional` reads and writes rows sent as
//! bare arrays of decimal strings.
//! - With the `keys` feature, `MarketKey` names one instrument as
//! `venue.product:id`. Only a product's `KeySpace` makes one, so two keys
//! are equal exactly when they name the same instrument; `RawKey` is text
//! split into its parts and checked by no product yet. Each `KeySpace`
//! declares its product's `ProductClass`, which every key it makes carries.
//! - With the `market` feature, the traits a venue's products implement so
//! market data reads the same on every venue: `MarketData`, which every
//! product implements, and the capability traits `Instruments`, `Trades`,
//! `Candles`, `Funding` and `EventGroups`, each with a `Dyn` wrapper. The
//! class bundles `PerpetualMarket`, `EventContractMarket` and `SpotMarket`
//! name what every product of a class offers. The traits return the records
//! market data is read into (`Instrument`, `Quote`, `Book`, `Trade`, `Candle`,
//! `FundingRate` and `EventGroup`), each carrying `Extensions`, a venue's own
//! facts on a shared record, one value per type.
//! - With the `trading` feature, `Trading` places and cancels orders, reads
//! open orders, positions and balances, and streams a venue's
//! acknowledgements and fills as `TradingEvents`, which begins with a
//! `Resync` and carries another after every reconnect. It works in
//! `OrderRequest`, `Order`, `Fill`, `Position` and `Balance`, with the opaque
//! `OrderId`, `FillId` and `ClientOrderId`, each record carrying
//! `Extensions`; `Extensions::ensure_declared` is how a venue refuses an
//! option it does not declare.
//!
//! By default the crate depends on nothing (on wasm32, only `web-time`, which
//! reads the browser's wall clock), so a credential-free socket crate can use
//! it without building an HTTP or signing stack. The enum macros name
//! `::serde`, so a crate that invokes them depends on serde itself, with
//! serde's `derive` feature for `wire_enum!`, which derives the two traits;
//! `open_enum!` implements them by hand.
//!
//! ```
//! use polyoxide_venue::{class_for_status, Class};
//!
//! let class = class_for_status(503).unwrap().with_code("dependency_unavailable");
//! assert!(class.is_retriable());
//! assert_eq!(class.code(), Some("dependency_unavailable"));
//! assert_eq!(class_for_status(451), Some(Class::Restricted));
//! ```
;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use Secret;
pub use ;
pub use class_for_status;
pub use UnixMillis;
pub use ;
pub use UnknownVariant;
// Every public error type implements `Classify`; one without it fails the
// build here. `.github/scripts/tests/test_classify_coverage.py` fails when a
// public error type is missing from this list.
const _: fn = ;