From 44e9cb08f683662662a668905aa90a95637675a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Wed, 22 May 2024 17:11:26 +0300 Subject: [PATCH 1/5] Accept empty `latching` field --- src/record_types/chunk.rs | 7 +++---- src/record_types/connection.rs | 4 ++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/record_types/chunk.rs b/src/record_types/chunk.rs index 0872478..576e7bd 100644 --- a/src/record_types/chunk.rs +++ b/src/record_types/chunk.rs @@ -19,10 +19,10 @@ pub enum Compression { impl Compression { fn decompress(self, data: &[u8], decompressed_size: Option) -> Result> { + let decompressed_len = decompressed_size.map(|s| s as usize).unwrap_or(data.len()); Ok(match self { Compression::Bzip2 => { - let mut decompressed = Vec::new(); - decompressed.reserve(decompressed_size.map(|s| s as usize).unwrap_or(data.len())); + let mut decompressed = Vec::with_capacity(decompressed_len); let mut decompressor = bzip2::Decompress::new(false); decompressor .decompress_vec(data, &mut decompressed) @@ -32,8 +32,7 @@ impl Compression { Compression::Lz4 => { let mut decoder = lz4::Decoder::new(data) .map_err(|e| Error::Lz4DecompressionError(e.to_string()))?; - let mut decompressed = Vec::new(); - decompressed.reserve(decompressed_size.map(|s| s as usize).unwrap_or(data.len())); + let mut decompressed = Vec::with_capacity(decompressed_len); std::io::copy(&mut decoder, &mut decompressed).map_err(|_| { Error::Lz4DecompressionError("Error while decoding".to_string()) })?; diff --git a/src/record_types/connection.rs b/src/record_types/connection.rs index c592861..163c839 100644 --- a/src/record_types/connection.rs +++ b/src/record_types/connection.rs @@ -74,6 +74,10 @@ impl<'a> RecordGen<'a> for Connection<'a> { latching = match val { b"1" => true, b"0" => false, + b"" => { + log::warn!("Got empty latching field, interpreting it as 0"); + false + } _ => return Err(Error::InvalidRecord), } } From 1422ea37b733e667e577d486aa36b703a0e1dd29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Wed, 22 May 2024 17:17:49 +0300 Subject: [PATCH 2/5] Bump crate version to v0.6.2 and update dependencies --- CHANGELOG.md | 7 +++++++ Cargo.toml | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6c1458..9c8cd29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.6.2 - 2024-05-22 +### Changed +- Accept empty `latching` field in connection headers ([#5]) + +[#5]: https://github.com/newpavlov/rosbag-rs/pull/5 + + ## 0.6.1 - 2022-09-02 ### Changed - The crate has migrated to a new repository ([#1]) diff --git a/Cargo.toml b/Cargo.toml index 26c1ad0..bea0aea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rosbag" -version = "0.6.1" +version = "0.6.2" description = "Utilities for reading ROS bag files." authors = ["Artyom Pavlov "] license = "MIT OR Apache-2.0" @@ -15,7 +15,7 @@ categories = ["parser-implementations", "science::robotics"] [dependencies] byteorder = "1.1" bzip2 = "0.4.3" -base16ct = "0.1" +base16ct = "0.2" log = "0.4.4" lz4 = "1.23.2" -memmap2 = "0.5" +memmap2 = "0.9" From 8fa078be96eb38e4237cb553225679ba51ffddf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Wed, 22 May 2024 17:18:56 +0300 Subject: [PATCH 3/5] Bump MSRV --- .github/workflows/rosbag.yml | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rosbag.yml b/.github/workflows/rosbag.yml index 770338e..91ae029 100644 --- a/.github/workflows/rosbag.yml +++ b/.github/workflows/rosbag.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v1 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.56.0 # MSRV + toolchain: 1.60.0 # MSRV components: clippy override: true profile: minimal @@ -63,7 +63,7 @@ jobs: strategy: matrix: rust: - - 1.56.0 # MSRV + - 1.60.0 # MSRV - stable steps: - uses: actions/checkout@v1 diff --git a/Cargo.toml b/Cargo.toml index bea0aea..6773c00 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ description = "Utilities for reading ROS bag files." authors = ["Artyom Pavlov "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.56" +rust-version = "1.60" readme = "README.md" documentation = "https://docs.rs/rosbag" repository = "https://github.com/newpavlov/rosbag-rs" From 13bba668f150002fc2df6d3a7bcf26b3c93328cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Wed, 22 May 2024 17:21:34 +0300 Subject: [PATCH 4/5] Bump MSRV to 1.63 --- .github/workflows/rosbag.yml | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rosbag.yml b/.github/workflows/rosbag.yml index 91ae029..61dc7a5 100644 --- a/.github/workflows/rosbag.yml +++ b/.github/workflows/rosbag.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v1 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.60.0 # MSRV + toolchain: 1.63.0 # MSRV components: clippy override: true profile: minimal @@ -63,7 +63,7 @@ jobs: strategy: matrix: rust: - - 1.60.0 # MSRV + - 1.63.0 # MSRV - stable steps: - uses: actions/checkout@v1 diff --git a/Cargo.toml b/Cargo.toml index 6773c00..5ef90e6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ description = "Utilities for reading ROS bag files." authors = ["Artyom Pavlov "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.60" +rust-version = "1.63" readme = "README.md" documentation = "https://docs.rs/rosbag" repository = "https://github.com/newpavlov/rosbag-rs" From 852e796cf6bd9885cd57540fea3067fc41222bbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Wed, 22 May 2024 17:23:35 +0300 Subject: [PATCH 5/5] Remove MSRV section from README --- README.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/README.md b/README.md index fd2a1be..c494397 100644 --- a/README.md +++ b/README.md @@ -51,13 +51,6 @@ for record in bag.index_records() { } ``` -## Minimum Supported Rust Version - -Rust **1.56** or higher. - -Minimum supported Rust version can be changed in the future, but it will be -done with a minor version bump. - ## License The crate is licensed under either of