barter_instrument_copy/
lib.rs1use derive_more::Constructor;
2use serde::{Deserialize, Serialize};
3
4pub mod exchange;
6
7pub mod asset;
11
12pub mod instrument;
16
17pub mod market;
18
19#[derive(
20 Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Deserialize, Serialize, Constructor,
21)]
22pub struct Keyed<Key, Value> {
23 pub key: Key,
24 pub value: Value,
25}
26
27impl<Key, Value> AsRef<Value> for Keyed<Key, Value> {
28 fn as_ref(&self) -> &Value {
29 &self.value
30 }
31}
32
33#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Deserialize, Serialize)]
34pub struct Underlying<AssetKey> {
35 pub base: AssetKey,
36 pub quote: AssetKey,
37}
38
39impl<AssetKey> Underlying<AssetKey> {
40 pub fn new<A>(base: A, quote: A) -> Self
41 where
42 A: Into<AssetKey>,
43 {
44 Self {
45 base: base.into(),
46 quote: quote.into(),
47 }
48 }
49}