Skip to content

Commit

Permalink
Merge pull request #587 from qarmin/set_minimial_rust_version
Browse files Browse the repository at this point in the history
Set minimal rust version to 1.72.0
  • Loading branch information
Enet4 authored Nov 5, 2024
2 parents f83125b + 12a03ae commit eafc891
Show file tree
Hide file tree
Showing 19 changed files with 61 additions and 15 deletions.
36 changes: 30 additions & 6 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
strategy:
matrix:
rust:
- 1.72.0
- stable
- beta
steps:
Expand All @@ -24,16 +25,39 @@ jobs:
components: clippy
cache: true
# test project with default + extra features
- run: cargo test --features image,ndarray,sop-class,rle,cli,jpegxl
- if: matrix.rust == 'stable' || matrix.rust == 'beta'
run: cargo test --features image,ndarray,sop-class,rle,cli,jpegxl
# test dicom-pixeldata with openjp2
- run: cargo test -p dicom-pixeldata --features openjp2
- if: matrix.rust == 'stable' || matrix.rust == 'beta'
run: cargo test -p dicom-pixeldata --features openjp2
# test dicom-pixeldata with openjpeg-sys and charls
- run: cargo test -p dicom-pixeldata --features openjpeg-sys,charls
- if: matrix.rust == 'stable' || matrix.rust == 'beta'
run: cargo test -p dicom-pixeldata --features openjpeg-sys,charls
# test dicom-pixeldata with gdcm-rs
- run: cargo test -p dicom-pixeldata --features gdcm
- if: matrix.rust == 'stable' || matrix.rust == 'beta'
run: cargo test -p dicom-pixeldata --features gdcm
# test dicom-pixeldata without default features
- run: cargo test -p dicom-pixeldata --no-default-features
- run: cargo test -p dicom-ul --features async
- if: matrix.rust == 'stable' || matrix.rust == 'beta'
run: cargo test -p dicom-pixeldata --no-default-features
# test dicom-ul with async feature
- if: matrix.rust == 'stable' || matrix.rust == 'beta'
run: cargo test -p dicom-ul --features async
# test library projects with minimum rust version
- if: matrix.rust == '1.72.0'
run: |
cargo test -p dicom-core
cargo test -p dicom-encoding
cargo test -p dicom-dictionary-std
cargo test -p dicom-parser
cargo test -p dicom-transfer-syntax-registry
cargo test -p dicom-object
cargo test -p dicom-dump --no-default-features --features sop-class
cargo test -p dicom-json
cargo test -p dicom-ul
cargo test -p dicom-pixeldata
cargo check -p dicom
env:
RUSTFLAGS: -W warnings
# run Clippy with stable toolchain
- if: matrix.rust == 'stable'
run: cargo clippy
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ no other development dependencies are necessary
unless certain extensions are included via Cargo features.
Consult each crate for guidelines on selecting features to suit your needs.

Minimum supported Rust version is 1.72.0 and only applies to the library crates with default features.
Binary crates and extra features may require a newer version of Rust.

## Roadmap & Contributing

This project is under active development.
Expand Down
1 change: 1 addition & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
msrv="1.72.0"
1 change: 1 addition & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.7.1"
authors = ["Eduardo Pinho <enet4mikeenet@gmail.com>"]
description = "Efficient and practical core library for DICOM compliant systems"
edition = "2018"
rust-version = "1.72.0"
license = "MIT OR Apache-2.0"
repository = "https://github.com/Enet4/dicom-rs"
keywords = ["dicom"]
Expand Down
1 change: 1 addition & 0 deletions dictionary-std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.7.0"
authors = ["Eduardo Pinho <enet4mikeenet@gmail.com>"]
description = "Standard DICOM attribute dictionary"
edition = "2018"
rust-version = "1.72.0"
license = "MIT OR Apache-2.0"
repository = "https://github.com/Enet4/dicom-rs"
keywords = ["dicom", "dictionary"]
Expand Down
1 change: 1 addition & 0 deletions dump/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.7.1"
authors = ["Eduardo Pinho <enet4mikeenet@gmail.com>"]
description = "A CLI tool for inspecting DICOM files"
edition = "2018"
rust-version = "1.72.0"
license = "MIT OR Apache-2.0"
repository = "https://github.com/Enet4/dicom-rs"
categories = ["command-line-utilities"]
Expand Down
1 change: 1 addition & 0 deletions encoding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.7.1"
authors = ["Eduardo Pinho <enet4mikeenet@gmail.com>"]
description = "DICOM encoding and decoding primitives"
edition = "2018"
rust-version = "1.72.0"
license = "MIT OR Apache-2.0"
repository = "https://github.com/Enet4/dicom-rs"
categories = ["encoding"]
Expand Down
1 change: 1 addition & 0 deletions fromimage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "dicom-fromimage"
version = "0.7.0"
edition = "2018"
rust-version = "1.72.0"
authors = ["Eduardo Pinho <enet4mikeenet@gmail.com>"]
description = "A CLI tool for replacing the image content from DICOM files"
license = "MIT OR Apache-2.0"
Expand Down
1 change: 1 addition & 0 deletions object/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "dicom-object"
version = "0.7.1"
authors = ["Eduardo Pinho <enet4mikeenet@gmail.com>"]
edition = "2018"
rust-version = "1.72.0"
license = "MIT OR Apache-2.0"
repository = "https://github.com/Enet4/dicom-rs"
description = "A high-level API for reading and manipulating DICOM objects"
Expand Down
2 changes: 1 addition & 1 deletion object/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ mod tests {

#[test]
fn errors_not_too_large() {
assert_type_not_too_large::<AccessError>(56);
assert_type_not_too_large::<AccessError>(64);
}

#[test]
Expand Down
12 changes: 8 additions & 4 deletions object/src/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -940,19 +940,21 @@ where
/// reporting whether it was present.
pub fn remove_element_by_name(&mut self, name: &str) -> Result<bool, AccessByNameError> {
let tag = self.lookup_name(name)?;
Ok(self.entries.remove(&tag).is_some()).inspect(|&removed| {
Ok(self.entries.remove(&tag).is_some()).map(|removed| {
if removed {
self.len = Length::UNDEFINED;
}
removed
})
}

/// Remove and return a particular DICOM element by its tag.
pub fn take_element(&mut self, tag: Tag) -> Result<InMemElement<D>> {
self.entries
.remove(&tag)
.inspect(|_| {
.map(|e| {
self.len = Length::UNDEFINED;
e
})
.context(NoSuchDataElementTagSnafu { tag })
}
Expand All @@ -961,8 +963,9 @@ where
/// if it is present,
/// returns `None` otherwise.
pub fn take(&mut self, tag: Tag) -> Option<InMemElement<D>> {
self.entries.remove(&tag).inspect(|_| {
self.entries.remove(&tag).map(|e| {
self.len = Length::UNDEFINED;
e
})
}

Expand All @@ -974,8 +977,9 @@ where
let tag = self.lookup_name(name)?;
self.entries
.remove(&tag)
.inspect(|_| {
.map(|e| {
self.len = Length::UNDEFINED;
e
})
.with_context(|| NoSuchDataElementAliasSnafu {
tag,
Expand Down
1 change: 1 addition & 0 deletions parent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.7.1"
authors = ["Eduardo Pinho <enet4mikeenet@gmail.com>"]
description = "A pure Rust implementation of the DICOM standard"
edition = "2018"
rust-version = "1.72.0"
license = "MIT OR Apache-2.0"
repository = "https://github.com/Enet4/dicom-rs"
readme = "README.md"
Expand Down
1 change: 1 addition & 0 deletions parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.7.1"
authors = ["Eduardo Pinho <enet4mikeenet@gmail.com>"]
description = "A middle-level parser and printer of DICOM data sets"
edition = "2018"
rust-version = "1.72.0"
license = "MIT OR Apache-2.0"
repository = "https://github.com/Enet4/dicom-rs"
categories = ["parser-implementations"]
Expand Down
3 changes: 2 additions & 1 deletion parser/src/stateful/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -913,8 +913,9 @@ where
.context(DecodeItemHeaderSnafu {
position: self.position,
})
.inspect(|_| {
.map(|header| {
self.position += 8;
header
})
.map_err(From::from)
}
Expand Down
1 change: 1 addition & 0 deletions pixeldata/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "dicom-pixeldata"
version = "0.7.1"
authors = ["Eduardo Pinho <enet4mikeenet@gmail.com>", "Peter Evers <pevers90@gmail.com>"]
edition = "2018"
rust-version = "1.72.0"
license = "MIT OR Apache-2.0"
description = "A high-level API for decoding DICOM objects into images and ndarrays"
repository = "https://github.com/Enet4/dicom-rs"
Expand Down
7 changes: 4 additions & 3 deletions pixeldata/src/attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,11 +626,12 @@ mod tests {

#[test]
fn errors_are_not_too_large() {
let max_size = 88;
let size = std::mem::size_of::<super::GetAttributeError>();
assert!(
size <= 80,
"GetAttributeError size is too large ({} > 80)",
size
size <= max_size,
"GetAttributeError size is too large ({} > {})",
size, max_size
);
}

Expand Down
1 change: 1 addition & 0 deletions toimage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "dicom-toimage"
version = "0.7.1"
edition = "2018"
rust-version = "1.72.0"
authors = ["Eduardo Pinho <enet4mikeenet@gmail.com>"]
description = "A CLI tool for converting DICOM files into general purpose image files"
license = "MIT OR Apache-2.0"
Expand Down
1 change: 1 addition & 0 deletions transfer-syntax-registry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.7.1"
authors = ["Eduardo Pinho <enet4mikeenet@gmail.com>"]
description = "A registry of DICOM transfer syntaxes"
edition = "2018"
rust-version = "1.72.0"
license = "MIT OR Apache-2.0"
repository = "https://github.com/Enet4/dicom-rs"
keywords = ["dicom"]
Expand Down
1 change: 1 addition & 0 deletions ul/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.7.1"
authors = ["Eduardo Pinho <enet4mikeenet@gmail.com>", "Paul Knopf <pauldotknopf@gmail.com>"]
description = "Types and methods for interacting with the DICOM Upper Layer Protocol"
edition = "2018"
rust-version = "1.72.0"
license = "MIT OR Apache-2.0"
repository = "https://github.com/Enet4/dicom-rs"
categories = ["network-programming"]
Expand Down

0 comments on commit eafc891

Please sign in to comment.