diff --git a/.github/workflows/rosbag.yml b/.github/workflows/rosbag.yml index 770338e..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.56.0 # MSRV + toolchain: 1.63.0 # MSRV components: clippy override: true profile: minimal @@ -63,7 +63,7 @@ jobs: strategy: matrix: rust: - - 1.56.0 # MSRV + - 1.63.0 # MSRV - stable steps: - uses: actions/checkout@v1 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..5ef90e6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,11 @@ [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" edition = "2021" -rust-version = "1.56" +rust-version = "1.63" readme = "README.md" documentation = "https://docs.rs/rosbag" repository = "https://github.com/newpavlov/rosbag-rs" @@ -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" 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 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), } }