Skip to content
This repository was archived by the owner on Jun 30, 2022. It is now read-only.

Commit a0b8b67

Browse files
committed
Add debug, eq, .. traits to public apis
1 parent 210087a commit a0b8b67

File tree

1 file changed

+29
-11
lines changed

1 file changed

+29
-11
lines changed

src/lib.rs

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub enum AccountType
4545
}
4646

4747
/// The current status of a price feed.
48-
#[derive(Copy, Clone, PartialEq, BorshSerialize, BorshDeserialize, Debug)]
48+
#[derive(Copy, Clone, Debug, PartialEq, Eq, BorshSerialize, BorshDeserialize)]
4949
#[repr(C)]
5050
pub enum PriceStatus
5151
{
@@ -59,34 +59,52 @@ pub enum PriceStatus
5959
Auction
6060
}
6161

62+
impl Default for PriceStatus {
63+
fn default() -> Self {
64+
PriceStatus::Unknown
65+
}
66+
}
67+
6268
/// Status of any ongoing corporate actions.
6369
/// (still undergoing dev)
64-
#[derive(Copy, Clone, PartialEq)]
70+
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
6571
#[repr(C)]
6672
pub enum CorpAction
6773
{
6874
NoCorpAct
6975
}
7076

77+
impl Default for CorpAction {
78+
fn default() -> Self {
79+
CorpAction::NoCorpAct
80+
}
81+
}
82+
7183
/// The type of prices associated with a product -- each product may have multiple price feeds of different types.
72-
#[derive(Copy, Clone, PartialEq)]
84+
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
7385
#[repr(C)]
7486
pub enum PriceType
7587
{
7688
Unknown,
7789
Price
7890
}
7991

92+
impl Default for PriceType {
93+
fn default() -> Self {
94+
PriceType::Unknown
95+
}
96+
}
97+
8098
/// Public key of a Solana account
81-
#[derive(Copy, Clone)]
99+
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
82100
#[repr(C)]
83101
pub struct AccKey
84102
{
85103
pub val: [u8;32]
86104
}
87105

88106
/// Mapping accounts form a linked-list containing the listing of all products on Pyth.
89-
#[derive(Copy, Clone)]
107+
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
90108
#[repr(C)]
91109
pub struct Mapping
92110
{
@@ -115,7 +133,7 @@ unsafe impl Pod for Mapping {}
115133

116134
/// Product accounts contain metadata for a single product, such as its symbol ("Crypto.BTC/USD")
117135
/// and its base/quote currencies.
118-
#[derive(Copy, Clone)]
136+
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
119137
#[repr(C)]
120138
pub struct Product
121139
{
@@ -147,7 +165,7 @@ unsafe impl Pod for Product {}
147165

148166
/// A price and confidence at a specific slot. This struct can represent either a
149167
/// publisher's contribution or the outcome of price aggregation.
150-
#[derive(Copy, Clone)]
168+
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
151169
#[repr(C)]
152170
pub struct PriceInfo
153171
{
@@ -167,7 +185,7 @@ pub struct PriceInfo
167185
}
168186

169187
/// The price and confidence contributed by a specific publisher.
170-
#[derive(Copy, Clone)]
188+
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
171189
#[repr(C)]
172190
pub struct PriceComp
173191
{
@@ -182,7 +200,7 @@ pub struct PriceComp
182200
}
183201

184202
/// An exponentially-weighted moving average.
185-
#[derive(Copy, Clone)]
203+
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
186204
#[repr(C)]
187205
pub struct Ema
188206
{
@@ -195,7 +213,7 @@ pub struct Ema
195213
}
196214

197215
/// Price accounts represent a continuously-updating price feed for a product.
198-
#[derive(Copy, Clone)]
216+
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
199217
#[repr(C)]
200218
pub struct Price
201219
{
@@ -332,7 +350,7 @@ impl Price {
332350
}
333351
}
334352

335-
#[derive(Copy, Clone)]
353+
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
336354
struct AccKeyU64
337355
{
338356
pub val: [u64;4]

0 commit comments

Comments
 (0)