Skip to content

Commit 52f7761

Browse files
Merge pull request #231 from MarijnS95/half-2.3-with-msrv
Allow `half 2.3` (and higher) to be used while also testing a 1.61 MSRV
2 parents 3a09cdd + 15333e6 commit 52f7761

File tree

3 files changed

+40
-33
lines changed

3 files changed

+40
-33
lines changed

.github/workflows/rust.yml

+16-12
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ jobs:
3737
run: cargo test --verbose
3838

3939
verify-msrv:
40-
runs-on: ubuntu-latest
41-
name: verify minimum supported rust version (ubuntu)
40+
strategy:
41+
matrix:
42+
os: [ubuntu-latest]
43+
runs-on: ${{ matrix.os }}
44+
name: verify minimum supported rust version without cache (takes longer, but caching produces unexpected behaviour)
4245
timeout-minutes: 30
4346

4447
# we are using the `cargo-msrv` app
@@ -47,14 +50,15 @@ jobs:
4750
steps:
4851
- uses: actions/checkout@v2
4952

50-
- name: Install foresterre/cargo-msrv without cache (takes longer, but caching produces unexpected behaviour)
53+
- name: Install foresterre/cargo-msrv
5154
run: cargo install cargo-msrv
5255

53-
- name: Verify the Rustc version declared in `cargo.toml` without cache (takes longer, but caching produces unexpected behaviour)
54-
run: |
55-
rm -f Cargo.lock
56-
cargo update
57-
cargo-msrv verify
56+
- uses: dtolnay/rust-toolchain@nightly
57+
- name: Generate Cargo.lock with minimal-version dependencies
58+
run: cargo -Zminimal-versions generate-lockfile
59+
60+
- name: Verify the Rustc version declared in `Cargo.toml` with `minimal-versions`
61+
run: cargo-msrv verify
5862

5963
# github actions does not support big endian systems directly, but it does support QEMU.
6064
# so we use cross-rs, which uses QEMU internally.
@@ -94,16 +98,16 @@ jobs:
9498

9599
steps:
96100
- uses: actions/checkout@v2
97-
101+
98102
- name: Cache Cargo Dependencies
99103
uses: Swatinem/[email protected]
100-
104+
101105
- name: Add wasm32 Target
102106
run: rustup target add wasm32-unknown-unknown
103-
107+
104108
- name: Build without default features
105109
run: cargo build --verbose --no-default-features --target wasm32-unknown-unknown
106-
110+
107111
- name: Run tests without default features
108112
run: cargo test --verbose --no-default-features
109113

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ proc-macro = false
2828

2929
[dependencies]
3030
lebe = "^0.5.2" # generic binary serialization
31-
half = ">=2.1.0, <2.3" # 16 bit float pixel data type
31+
half = "2.1.0" # 16 bit float pixel data type
3232
bit_field = "^0.10.1" # exr file version bit flags
3333
miniz_oxide = "^0.7.1" # zip compression for pxr24
3434
smallvec = "^1.7.0" # make cache-friendly allocations TODO profile if smallvec is really an improvement!

README.md

+23-20
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
[![Rust Docs](https://docs.rs/exr/badge.svg)](https://docs.rs/exr)
1+
[![Rust Docs](https://docs.rs/exr/badge.svg)](https://docs.rs/exr)
22
[![Rust Crate](https://img.shields.io/crates/v/exr.svg)](https://crates.io/crates/exr)
3-
[![Rust Lang Version](https://img.shields.io/badge/rustc-1.59.0-lightgray.svg)](https://blog.rust-lang.org/2022/02/24/Rust-1.59.0.html)
3+
[![Rust Lang Version](https://img.shields.io/badge/rustc-1.61.0-lightgray.svg)](https://blog.rust-lang.org/2022/05/19/Rust-1.61.0.html)
44
[![Wasm Ready](https://img.shields.io/badge/wasm-supported-%236d0)](https://github.com/johannesvollmer/exrs/actions?query=branch%3Amaster)
55
[![downloads](https://img.shields.io/crates/d/exr)](https://crates.io/crates/exr)
66
[![Lines of Code](https://tokei.rs/b1/github/johannesvollmer/exrs?category=code)](https://tokei.rs)
77

88
# EXRS
99

1010
This library is a 100% Rust and 100% safe code library for
11-
reading and writing OpenEXR images.
11+
reading and writing OpenEXR images.
1212

1313
[OpenEXR](http://www.openexr.com/)
1414
is the de-facto standard image format in animation, VFX, and
@@ -28,13 +28,13 @@ Features include:
2828

2929
### Current Status
3030

31-
This library has matured quite a bit, but should still be considered incomplete.
31+
This library has matured quite a bit, but should still be considered incomplete.
3232
For example, deep data and DWA compression algorithms are not supported yet.
3333

3434
If you encounter an exr file that cannot be opened by this crate but should be,
3535
please leave an issue on this repository, containing the image file.
3636

37-
The focus is set on supporting all feature and correctness;
37+
The focus is set on supporting all feature and correctness;
3838
some performance optimizations are to be done.
3939

4040
__What we can do:__
@@ -44,7 +44,7 @@ __What we can do:__
4444
- [x] multi-part images (multiple layers, like Photoshop)
4545
- [x] multi-resolution images (mip maps, rip maps)
4646
- [x] access meta data and raw pixel blocks independently
47-
- [x] automatically crop away transparent pixels of an image (opt-in)
47+
- [x] automatically crop away transparent pixels of an image (opt-in)
4848
- [ ] channel subsampling
4949
- [ ] deep data
5050
- [x] compression methods
@@ -68,14 +68,14 @@ __What we can do:__
6868
- [x] a full-fledged image data structure that can contain any exr image,
6969
can open any image with a single function call (`read_all_data_from_file`)
7070
without knowing anything about the file in advance
71-
- [x] decompress and decompress image sections either
71+
- [x] decompress and decompress image sections either
7272
in parallel or with low memory overhead
7373
- [x] read and write progress callback
7474
- [x] write blocks streams, one after another
75-
- [x] memory mapping automatically supported
75+
- [x] memory mapping automatically supported
7676
by using the generic `std::io::Read` and `std::io::Write` traits
7777

78-
78+
7979
<!-- detailed internal feature checklist:
8080
- [x] Inspecting Metadata
8181
- [x] Singlepart
@@ -97,7 +97,7 @@ __What we can do:__
9797
- [x] Reading those with known types
9898
- [x] Reading those with unknown types into a plain byte buffer
9999
- [x] Nice API for preview attribute extraction
100-
100+
101101
- [ ] Decompressing Pixel Data
102102
- [x] Any LineOrder
103103
- [x] Any Pixel Type (`f16`, `f32`, `u32`)
@@ -132,7 +132,7 @@ __What we can do:__
132132
- [x] PXR24 (lossless for f16 and u32)
133133
- [x] B44, B44A
134134
- [ ] DWAA, DWAB
135-
135+
136136
- [x] De/compressing multiple blocks in parallel
137137
138138
- [ ] Profiling and real optimization
@@ -149,27 +149,30 @@ __What we can do:__
149149
- [x] Enforce minimum length of 1 for arrays
150150
- [x] [Validate data_window matches data size when writing images] is not required because one is inferred from the other
151151
- [x] Channel names and layer names must be unique
152-
152+
153153
- [x] Explore different APIs
154154
- [x] Let user decide how to store data
155155
- [x] Loading Metadata and specific tiles or blocks separately
156156
-->
157-
157+
158158

159159
### Usage
160160

161+
> [!TIP]
162+
> If you want to use the newest version of `exrs` with an older Rust version, you can still do that, by forcing Rust to use a an older version of the `half` crate via `cargo update -p half --precise 2.2.1`, or downgrade all dependencies via `cargo +nightly -Zminimal-versions generate-lockfile`. `half 2.3.0` and higher have an MSRV above 1.61.
163+
161164
Add this to your `Cargo.toml`:
162165
```toml
163166
[dependencies]
164167
exr = "1.71.0"
165168

166-
# also, optionally add this to your crate for smaller binary size
169+
# also, optionally add this to your crate for smaller binary size
167170
# and better runtime performance
168171
[profile.release]
169172
lto = true
170173
```
171174

172-
The master branch of this repository always matches the `crates.io` version,
175+
The master branch of this repository always matches the `crates.io` version,
173176
so you could also link the github repository master branch.
174177

175178
### Example
@@ -216,8 +219,8 @@ Or read [the guide](https://github.com/johannesvollmer/exrs/tree/master/GUIDE.md
216219

217220
### Goals
218221

219-
`exrs` aims to provide a safe and convenient
220-
interface to the OpenEXR file format. It is designed
222+
`exrs` aims to provide a safe and convenient
223+
interface to the OpenEXR file format. It is designed
221224
to minimize the possibility of invalid files and runtime errors.
222225
It contains a full-fledged image data structure that can contain any exr image,
223226
but also grants access a low level block interface.
@@ -234,7 +237,7 @@ This library uses no unsafe code. In fact, this crate is annotated with `#[forbi
234237
Some dependencies use unsafe code, though this is minimized by selecting dependencies carefully.
235238

236239
All information from a file is handled with caution.
237-
Allocations have a safe maximum size that will not be exceeded at once,
240+
Allocations have a safe maximum size that will not be exceeded at once,
238241
to reduce memory exhaustion attacks.
239242

240243
### What I am proud of
@@ -272,7 +275,7 @@ and they offer several advantages over this Rust implementation:
272275

273276
### Specification
274277

275-
This library is modeled after the
278+
This library is modeled after the
276279
official [`OpenEXRFileLayout.pdf`](http://www.openexr.com/documentation.html)
277280
document. Unspecified behavior is concluded from the C++ library.
278281

@@ -300,4 +303,4 @@ Each command requires a running `docker` instance,
300303
and `cross-rs` to be installed on your machine (`cargo install cross`).
301304
- Mips (Big Endian) `cross test --target mips-unknown-linux-gnu --verbose`
302305

303-
To benchmark the library, simply run `cargo bench`.
306+
To benchmark the library, simply run `cargo bench`.

0 commit comments

Comments
 (0)