From 18f63000e78a0710070b5064eef67ab88ad06492 Mon Sep 17 00:00:00 2001 From: Carter Green Date: Thu, 7 Sep 2023 14:21:49 -0500 Subject: [PATCH 1/2] FIX: Fix conflicting borrow in symbology helpers --- CHANGELOG.md | 6 ++++++ rust/dbn/src/metadata.rs | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bd4d4e..4085f8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 0.10.1 - TBD + +### Bug fixes +- Changed `Metadata::symbol_map` and `symbol_map_for_date` to return `String` values + instead of `&str`, which made it difficult to use + ## 0.10.0 - 2023-09-07 ### Enhancements - Added `start` and `end` getters to `Metadata` that return `time::OffsetDateTime` diff --git a/rust/dbn/src/metadata.rs b/rust/dbn/src/metadata.rs index 3782228..214419b 100644 --- a/rust/dbn/src/metadata.rs +++ b/rust/dbn/src/metadata.rs @@ -96,7 +96,7 @@ impl Metadata { /// # Errors /// This function returns an error if it can't parse a symbol into a `u32` /// instrument ID. - pub fn symbol_map_for_date(&self, date: time::Date) -> crate::Result> { + pub fn symbol_map_for_date(&self, date: time::Date) -> crate::Result> { if date < self.start().date() || self.end().map_or(false, |end| end.date() <= date) { return Err(crate::Error::BadArgument { param_name: "date".to_owned(), @@ -118,7 +118,7 @@ impl Metadata { .symbol .parse() .map_err(|_| crate::Error::conversion::(interval.symbol.as_str()))?; - index.insert(iid, mapping.raw_symbol.as_str()); + index.insert(iid, mapping.raw_symbol.clone()); } } Ok(index) @@ -132,7 +132,7 @@ impl Metadata { /// # Errors /// This function returns an error if it can't parse a symbol into a `u32` /// instrument ID. - pub fn symbol_map(&self) -> crate::Result> { + pub fn symbol_map(&self) -> crate::Result> { let mut index = HashMap::new(); for mapping in self.mappings.iter() { for interval in mapping.intervals.iter() { @@ -146,7 +146,7 @@ impl Metadata { .parse() .map_err(|_| crate::Error::conversion::(interval.symbol.as_str()))?; loop { - index.insert((day, iid), mapping.raw_symbol.as_str()); + index.insert((day, iid), mapping.raw_symbol.clone()); day = day.next_day().unwrap(); if day == interval.end_date { break; From d18cc9ba2271667a70e8be91d263a138f65faae7 Mon Sep 17 00:00:00 2001 From: Carter Green Date: Thu, 7 Sep 2023 16:08:30 -0500 Subject: [PATCH 2/2] VER: Release DBN 0.10.1 --- CHANGELOG.md | 2 +- Cargo.lock | 10 +++++----- c/Cargo.toml | 2 +- python/Cargo.toml | 2 +- python/pyproject.toml | 2 +- rust/dbn-cli/Cargo.toml | 4 ++-- rust/dbn-macros/Cargo.toml | 2 +- rust/dbn/Cargo.toml | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4085f8b..270ec36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 0.10.1 - TBD +## 0.10.1 - 2023-09-07 ### Bug fixes - Changed `Metadata::symbol_map` and `symbol_map_for_date` to return `String` values diff --git a/Cargo.lock b/Cargo.lock index edef843..0916c2e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -272,7 +272,7 @@ dependencies = [ [[package]] name = "databento-dbn" -version = "0.10.0" +version = "0.10.1" dependencies = [ "dbn", "pyo3", @@ -281,7 +281,7 @@ dependencies = [ [[package]] name = "dbn" -version = "0.10.0" +version = "0.10.1" dependencies = [ "async-compression", "csv", @@ -300,7 +300,7 @@ dependencies = [ [[package]] name = "dbn-c" -version = "0.10.0" +version = "0.10.1" dependencies = [ "anyhow", "cbindgen", @@ -310,7 +310,7 @@ dependencies = [ [[package]] name = "dbn-cli" -version = "0.10.0" +version = "0.10.1" dependencies = [ "anyhow", "assert_cmd", @@ -324,7 +324,7 @@ dependencies = [ [[package]] name = "dbn-macros" -version = "0.10.0" +version = "0.10.1" dependencies = [ "proc-macro-crate", "proc-macro2", diff --git a/c/Cargo.toml b/c/Cargo.toml index 8364908..ec5f556 100644 --- a/c/Cargo.toml +++ b/c/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dbn-c" authors = ["Databento "] -version = "0.10.0" +version = "0.10.1" edition = "2021" description = "C bindings for working with Databento Binary Encoding (DBN)" license = "Apache-2.0" diff --git a/python/Cargo.toml b/python/Cargo.toml index 322c083..e0e716f 100644 --- a/python/Cargo.toml +++ b/python/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "databento-dbn" authors = ["Databento "] -version = "0.10.0" +version = "0.10.1" edition = "2021" description = "Python library written in Rust for working with Databento Binary Encoding (DBN)" license = "Apache-2.0" diff --git a/python/pyproject.toml b/python/pyproject.toml index 9bef164..7c1dcd6 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "databento-dbn" -version = "0.10.0" +version = "0.10.1" description = "Python bindings for encoding and decoding Databento Binary Encoding (DBN)" authors = ["Databento "] license = "Apache-2.0" diff --git a/rust/dbn-cli/Cargo.toml b/rust/dbn-cli/Cargo.toml index 216408a..b932994 100644 --- a/rust/dbn-cli/Cargo.toml +++ b/rust/dbn-cli/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dbn-cli" authors = ["Databento "] -version = "0.10.0" +version = "0.10.1" edition = "2021" description = "Command-line utility for converting Databento Binary Encoding (DBN) files to text-based formats" default-run = "dbn" @@ -17,7 +17,7 @@ path = "src/main.rs" [dependencies] # Databento common DBN library -dbn = { path = "../dbn", version = "=0.10.0", default-features = false } +dbn = { path = "../dbn", version = "=0.10.1", default-features = false } # Error handling anyhow = "1.0.72" diff --git a/rust/dbn-macros/Cargo.toml b/rust/dbn-macros/Cargo.toml index f08d5b0..89b61a5 100644 --- a/rust/dbn-macros/Cargo.toml +++ b/rust/dbn-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dbn-macros" authors = ["Databento "] -version = "0.10.0" +version = "0.10.1" edition = "2021" description = "Proc macros for dbn crate" license = "Apache-2.0" diff --git a/rust/dbn/Cargo.toml b/rust/dbn/Cargo.toml index 0b0e5f9..bfe281d 100644 --- a/rust/dbn/Cargo.toml +++ b/rust/dbn/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dbn" authors = ["Databento "] -version = "0.10.0" +version = "0.10.1" edition = "2021" description = "Library for working with Databento Binary Encoding (DBN)" license = "Apache-2.0" @@ -25,7 +25,7 @@ serde = ["dep:serde", "time/parsing", "time/serde"] trivial_copy = [] [dependencies] -dbn-macros = { version = "=0.10.0", path = "../dbn-macros" } +dbn-macros = { version = "=0.10.1", path = "../dbn-macros" } # async (de)compression async-compression = { version = "0.4.1", features = ["tokio", "zstd"], optional = true }