Skip to content

Commit

Permalink
REF: Rename dummy fields to reserved
Browse files Browse the repository at this point in the history
  • Loading branch information
threecgreen committed Feb 27, 2024
1 parent 92cb770 commit 82850e1
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
it's not a price, it uses the same fixed-price decimal format as other prices
- Made `StatType` and `VersionUpgradePolicy` non-exhaustive to allow future additions
without breaking changes
- Renamed `_dummy` field in `ImbalanceMsg` and `StatMsg` to `_reserved`

### Bug fixes
- Added missing `StatType::Vwap` variant used in the ICE datasets
Expand Down
12 changes: 6 additions & 6 deletions rust/dbn-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ pub fn dbn_attr(_item: TokenStream) -> TokenStream {
/// - `unix_nanos`: serializes the field as a UNIX timestamp, with the output format
/// depending on `PRETTY_TS`
///
/// Note: fields beginning with `_` will automatically be skipped, e.g. `_dummy` isn't
/// serialized.
/// Note: fields beginning with `_` will automatically be skipped, e.g. `_reserved`
/// isn't serialized.
#[proc_macro_derive(CsvSerialize, attributes(dbn))]
pub fn derive_csv_serialize(input: TokenStream) -> TokenStream {
serialize::derive_csv_macro_impl(input)
Expand All @@ -51,8 +51,8 @@ pub fn derive_csv_serialize(input: TokenStream) -> TokenStream {
/// - `unix_nanos`: serializes the field as a UNIX timestamp, with the output format
/// depending on `PRETTY_TS`
///
/// Note: fields beginning with `_` will automatically be skipped, e.g. `_dummy` isn't
/// serialized.
/// Note: fields beginning with `_` will automatically be skipped, e.g. `_reserved`
/// isn't serialized.
#[proc_macro_derive(JsonSerialize, attributes(dbn))]
pub fn derive_json_serialize(input: TokenStream) -> TokenStream {
serialize::derive_json_macro_impl(input)
Expand Down Expand Up @@ -106,8 +106,8 @@ pub fn dbn_record(attr: TokenStream, input: TokenStream) -> TokenStream {
/// field. If the getter returns an error, the raw field value will be used
/// - `skip`: won't be included in the `Debug` output
///
/// Note: fields beginning with `_` will automatically be skipped, e.g. `_dummy` isn't
/// included in the `Debug` output.
/// Note: fields beginning with `_` will automatically be skipped, e.g. `_reserved`
/// isn't included in the `Debug` output.
#[proc_macro_derive(RecordDebug, attributes(dbn))]
pub fn derive_record_debug(input: TokenStream) -> TokenStream {
debug::derive_impl(input)
Expand Down
4 changes: 2 additions & 2 deletions rust/dbn/src/encode/csv/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ mod tests {
num_extensions: 16,
unpaired_side: 'A' as c_char,
significant_imbalance: 'N' as c_char,
_dummy: [0],
_reserved: [0],
}];
let mut buffer = Vec::new();
let writer = BufWriter::new(&mut buffer);
Expand Down Expand Up @@ -833,7 +833,7 @@ mod tests {
channel_id: 7,
update_action: StatUpdateAction::New as u8,
stat_flags: 0,
_dummy: Default::default(),
_reserved: Default::default(),
}];
let mut buffer = Vec::new();
let writer = BufWriter::new(&mut buffer);
Expand Down
4 changes: 2 additions & 2 deletions rust/dbn/src/encode/json/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ mod tests {
num_extensions: 16,
unpaired_side: 'A' as c_char,
significant_imbalance: 'N' as c_char,
_dummy: [0],
_reserved: [0],
}];
let slice_res = write_json_to_string(data.as_slice(), false, false, false);
let stream_res = write_json_stream_to_string(data, false, false, false);
Expand Down Expand Up @@ -592,7 +592,7 @@ mod tests {
channel_id: 7,
update_action: StatUpdateAction::New as u8,
stat_flags: 0,
_dummy: Default::default(),
_reserved: Default::default(),
}];
let slice_res = write_json_to_string(data.as_slice(), false, true, false);
let stream_res = write_json_stream_to_string(data, false, true, false);
Expand Down
4 changes: 2 additions & 2 deletions rust/dbn/src/python/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1748,7 +1748,7 @@ impl ImbalanceMsg {
num_extensions: 0,
unpaired_side: 0,
significant_imbalance,
_dummy: [0],
_reserved: [0],
}
}

Expand Down Expand Up @@ -1913,7 +1913,7 @@ impl StatMsg {
channel_id,
update_action: update_action.unwrap_or(StatUpdateAction::New as u8),
stat_flags: stat_flags.unwrap_or_default(),
_dummy: Default::default(),
_reserved: Default::default(),
}
}

Expand Down
4 changes: 2 additions & 2 deletions rust/dbn/src/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ pub struct ImbalanceMsg {
// Filler for alignment.
#[doc(hidden)]
#[cfg_attr(feature = "serde", serde(skip))]
pub _dummy: [u8; 1],
pub _reserved: [u8; 1],
}

/// A statistics message. A catchall for various data disseminated by publishers.
Expand Down Expand Up @@ -809,7 +809,7 @@ pub struct StatMsg {
// Filler for alignment
#[doc(hidden)]
#[cfg_attr(feature = "serde", serde(skip))]
pub _dummy: [u8; 6],
pub _reserved: [u8; 6],
}

/// An error message from the Databento Live Subscription Gateway (LSG).
Expand Down
4 changes: 2 additions & 2 deletions rust/dbn/src/record/impl_default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ impl Default for ImbalanceMsg {
num_extensions: 0,
unpaired_side: 0,
significant_imbalance: b'~' as c_char,
_dummy: Default::default(),
_reserved: Default::default(),
}
}
}
Expand All @@ -315,7 +315,7 @@ impl Default for StatMsg {
channel_id: 0,
update_action: StatUpdateAction::New as u8,
stat_flags: 0,
_dummy: Default::default(),
_reserved: Default::default(),
}
}
}
Expand Down

0 comments on commit 82850e1

Please sign in to comment.