|
@@ -4,6 +4,7 @@
|
|
|
|
|
|
|
|
use {
|
|
use {
|
|
|
super::router::{Price, PriceFeedId, TimestampUs},
|
|
super::router::{Price, PriceFeedId, TimestampUs},
|
|
|
|
|
+ derive_more::derive::From,
|
|
|
serde::{Deserialize, Serialize},
|
|
serde::{Deserialize, Serialize},
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -32,6 +33,21 @@ pub struct PriceFeedData {
|
|
|
pub best_ask_price: Option<Price>,
|
|
pub best_ask_price: Option<Price>,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/// A response sent from the server to the publisher client.
|
|
|
|
|
+/// Currently only serde errors are reported back to the client.
|
|
|
|
|
+#[derive(Debug, Clone, Serialize, Deserialize, From)]
|
|
|
|
|
+#[serde(tag = "type")]
|
|
|
|
|
+#[serde(rename_all = "camelCase")]
|
|
|
|
|
+pub enum PublisherResponse {
|
|
|
|
|
+ UpdateDeserializationError(UpdateDeserializationErrorResponse),
|
|
|
|
|
+}
|
|
|
|
|
+/// Sent to the publisher if the binary data could not be parsed
|
|
|
|
|
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
|
|
|
+#[serde(rename_all = "camelCase")]
|
|
|
|
|
+pub struct UpdateDeserializationErrorResponse {
|
|
|
|
|
+ pub error: String,
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
#[test]
|
|
#[test]
|
|
|
fn price_feed_data_serde() {
|
|
fn price_feed_data_serde() {
|
|
|
let data = [
|
|
let data = [
|