From 61a51ea4368130f7a61f35afb5cd766d0e9fa90c Mon Sep 17 00:00:00 2001 From: Austin Le Date: Tue, 29 Sep 2026 14:26:07 -0700 Subject: [PATCH 1/3] Switch to ort rc.10 --- rust/Cargo.lock | 141 +++++++++++++++++++++++++++++++++++++++--------- rust/Cargo.toml | 8 +-- 2 files changed, 120 insertions(+), 29 deletions(-) diff --git a/rust/Cargo.lock b/rust/Cargo.lock index a5649c3..1af6d22 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -217,6 +217,15 @@ dependencies = [ "no_std_io2", ] +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + [[package]] name = "built" version = "0.8.1" @@ -372,6 +381,15 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.5.2" @@ -448,6 +466,16 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + [[package]] name = "der" version = "0.8.2" @@ -458,6 +486,16 @@ dependencies = [ "zeroize", ] +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + [[package]] name = "displaydoc" version = "0.2.7" @@ -527,7 +565,7 @@ dependencies = [ "num-complex", "pulp", "rayon-core", - "smallvec", + "smallvec 1.16.2", "zune-inflate", ] @@ -567,6 +605,16 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "filetime" +version = "0.2.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759" +dependencies = [ + "cfg-if", + "libc", +] + [[package]] name = "find-msvc-tools" version = "0.1.14" @@ -632,6 +680,16 @@ dependencies = [ "slab", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + [[package]] name = "getrandom" version = "0.2.17" @@ -699,12 +757,6 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" -[[package]] -name = "hmac-sha256" -version = "1.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad320b3b96fb2a455a0726d16efe0a5afdbd34b71dea5bc53b05ea057714d4e" - [[package]] name = "http" version = "1.5.0" @@ -758,7 +810,7 @@ dependencies = [ "icu_normalizer_data", "icu_properties", "icu_provider", - "smallvec", + "smallvec 1.16.2", "zerovec", ] @@ -811,7 +863,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" dependencies = [ "idna_adapter", - "smallvec", + "smallvec 1.16.2", "utf8_iter", ] @@ -999,12 +1051,6 @@ dependencies = [ "imgref", ] -[[package]] -name = "lzma-rust2" -version = "0.15.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e20f57f9918e5bd7bc58c22cdd70a6afc7375d4dd9683af5f2b34bd3d2bba619" - [[package]] name = "matrixmultiply" version = "0.3.11" @@ -1080,9 +1126,9 @@ dependencies = [ [[package]] name = "ndarray" -version = "0.17.2" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520080814a7a6b4a6e9070823bb24b4531daac8c4627e08ba5de8c5ef2f2752d" +checksum = "882ed72dce9365842bf196bdeedf5055305f11fc8c03dee7bb0194a6cad34841" dependencies = [ "matrixmultiply", "num-complex", @@ -1246,25 +1292,26 @@ dependencies = [ [[package]] name = "ort" -version = "2.0.0-rc.12" +version = "2.0.0-rc.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7de3af33d24a745ffb8fab904b13478438d1cd52868e6f17735ef6e1f8bf133" +checksum = "1fa7e49bd669d32d7bc2a15ec540a527e7764aec722a45467814005725bcd721" dependencies = [ "ndarray", "ort-sys", - "smallvec", + "smallvec 2.0.0-alpha.10", "tracing", - "ureq 3.4.2", ] [[package]] name = "ort-sys" -version = "2.0.0-rc.12" +version = "2.0.0-rc.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7b497d21a8b6fbb4b5a544f8fadb77e801a09ae0add9e411d31c6f89e3c1e90" +checksum = "e2aba9f5c7c479925205799216e7e5d07cc1d4fa76ea8058c60a9a30f6a4e890" dependencies = [ - "hmac-sha256", - "lzma-rust2", + "flate2", + "pkg-config", + "sha2", + "tar", "ureq 3.4.2", ] @@ -1811,6 +1858,17 @@ dependencies = [ "zmij", ] +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "shlex" version = "2.0.1" @@ -1844,6 +1902,12 @@ version = "1.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9395f0f0eee849a9b707b2f06bb92a6a422090e2123bb2ef8e87a0e61892a8e" +[[package]] +name = "smallvec" +version = "2.0.0-alpha.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d44cfb396c3caf6fbfd0ab422af02631b69ddd96d2eff0b0f0724f9024051b" + [[package]] name = "socks" version = "0.3.4" @@ -1906,6 +1970,17 @@ dependencies = [ "syn 3.0.6", ] +[[package]] +name = "tar" +version = "0.4.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840" +dependencies = [ + "filetime", + "libc", + "xattr", +] + [[package]] name = "tempfile" version = "3.27.0" @@ -2035,6 +2110,12 @@ dependencies = [ "trustmark", ] +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + [[package]] name = "unicode-ident" version = "1.0.26" @@ -2390,6 +2471,16 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" +[[package]] +name = "xattr" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156" +dependencies = [ + "libc", + "rustix", +] + [[package]] name = "xtask" version = "0.1.0" diff --git a/rust/Cargo.toml b/rust/Cargo.toml index f4a907e..6ceea72 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -8,7 +8,7 @@ authors = [ "Andrew Halle ", "Austin Le " ] -rust-version = "1.88.0" +rust-version = "1.81.0" edition = "2021" license = "MIT" keywords = ["trustmark", "cv", "watermark"] @@ -29,9 +29,9 @@ harness = false [dependencies] image = "0.25.6" fast_image_resize = { version = "5.1.4", features = ["image", "rayon"] } -ndarray = "0.17" -ort = "=2.0.0-rc.12" -ort-sys = { version = "=2.0.0-rc.12", default-features = false } +ndarray = "0.16" +ort = "=2.0.0-rc.10" +ort-sys = { version = "=2.0.0-rc.10", default-features = false } thiserror = "1" [dev-dependencies] From 9d4abca65846e687d396358c889b9d31fae1c4a4 Mon Sep 17 00:00:00 2001 From: Austin Le Date: Tue, 29 Sep 2026 15:20:24 -0700 Subject: [PATCH 2/3] Bump to v0.4.0. Update changelog. --- rust/CHANGELOG.md | 5 +++++ rust/Cargo.lock | 2 +- rust/Cargo.toml | 4 ++-- rust/README.md | 4 ++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/rust/CHANGELOG.md b/rust/CHANGELOG.md index b1fba55..f84912d 100644 --- a/rust/CHANGELOG.md +++ b/rust/CHANGELOG.md @@ -6,6 +6,11 @@ crate is versioned independently of the Python package in this repository. Entries for releases before 0.3.0 were reconstructed from the commit history, since those versions were published manually and without tags. +## 0.4.0 + +- Downgrade `ort` to 2.0.0-rc.10 to restore support for Intel macOS. +- Downgrade `ndarray` to 0.16 to match the version used by `ort` 2.0.0-rc.10. + ## 0.3.0 - Upgrade `ort` to 2.0.0-rc.12. This is the fix for 0.2.2 no longer being diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 1af6d22..d4e2b6a 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -2089,7 +2089,7 @@ dependencies = [ [[package]] name = "trustmark" -version = "0.3.0" +version = "0.4.0" dependencies = [ "criterion", "fast_image_resize", diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 6ceea72..d05c30a 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -1,14 +1,14 @@ [package] name = "trustmark" description = "A Rust implementation of TrustMark" -version = "0.3.0" +version = "0.4.0" authors = [ "John Collomosse ", "Maurice Fisher ", "Andrew Halle ", "Austin Le " ] -rust-version = "1.81.0" +rust-version = "1.88.0" edition = "2021" license = "MIT" keywords = ["trustmark", "cv", "watermark"] diff --git a/rust/README.md b/rust/README.md index 8412abb..af7a2bc 100644 --- a/rust/README.md +++ b/rust/README.md @@ -18,7 +18,7 @@ Open an issue if there's something in the Python version that want added to this ## Platform Support -Building this crate requires Rust 1.88 or newer. TrustMark 0.3.0 uses [ort](https://ort.pyke.io) 2.0.0-rc.12 as its ONNX runtime, so it can only be used on platforms supported by that crate. See [the documentation](https://ort.pyke.io/setup/platforms) for supported platforms. +Building this crate requires Rust 1.88 or newer. TrustMark 0.4.0 uses [ort](https://ort.pyke.io) 2.0.0-rc.10 as its ONNX runtime, so it can only be used on platforms supported by that crate. See [the documentation](https://ort.pyke.io/setup/platforms) for supported platforms. In particular, the ONNX runtime requires either: @@ -61,7 +61,7 @@ Add `trustmark` to your project's `cargo` manifest with: cargo add trustmark ``` -This installs the version available on crates.io; TrustMark 0.3.0 contains the ORT rc.12 upgrade. +This installs the version available on crates.io; TrustMark 0.4.0 contains the ORT rc.10 change. A basic example of using `trustmark` is: From 52231d258dcde6f2ed170da630039b644b0632f7 Mon Sep 17 00:00:00 2001 From: Austin Le Date: Tue, 29 Sep 2026 15:23:35 -0700 Subject: [PATCH 3/3] Fix redundant ort::Error conversions --- rust/src/lib.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 5a813fb..ce66dcb 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -99,16 +99,12 @@ impl Trustmark { version: Version, ) -> Result { let encoder = Session::builder()? - .with_optimization_level(GraphOptimizationLevel::Level3) - .map_err(ort::Error::from)? - .with_intra_threads(8) - .map_err(ort::Error::from)? + .with_optimization_level(GraphOptimizationLevel::Level3)? + .with_intra_threads(8)? .commit_from_file(models.as_ref().join(variant.encoder_filename()))?; let decoder = Session::builder()? - .with_optimization_level(GraphOptimizationLevel::Level3) - .map_err(ort::Error::from)? - .with_intra_threads(8) - .map_err(ort::Error::from)? + .with_optimization_level(GraphOptimizationLevel::Level3)? + .with_intra_threads(8)? .commit_from_file(models.as_ref().join(variant.decoder_filename()))?; Ok(Self { encoder: Mutex::new(encoder),