diff --git a/.github/workflows/no_std.yml b/.github/workflows/no_std.yml index d3d964bb..c87679d6 100644 --- a/.github/workflows/no_std.yml +++ b/.github/workflows/no_std.yml @@ -24,15 +24,16 @@ jobs: # Target below does not have a standard library - run: rustup target add x86_64-unknown-uefi # Below targets run in no-std environments - - run: cargo build -p zune-core --target x86_64-unknown-uefi --no-default-features - - run: cargo build -p zune-inflate --target x86_64-unknown-uefi --no-default-features - - run: cargo build -p zune-jpeg --target x86_64-unknown-uefi --no-default-features - - run: cargo build -p zune-png --target x86_64-unknown-uefi --no-default-features - - run: cargo build -p zune-ppm --target x86_64-unknown-uefi --no-default-features - - run: cargo build -p zune-qoi --target x86_64-unknown-uefi --no-default-features - - run: cargo build -p zune-farbfeld --target x86_64-unknown-uefi --no-default-features - - run: cargo build -p zune-psd --target x86_64-unknown-uefi --no-default-features - - run: cargo build -p zune-bmp --target x86_64-unknown-uefi --no-default-features - + - run: cargo build -p zune-core --target x86_64-unknown-uefi --no-default-features --features log,serde + - run: cargo build -p zune-inflate --target x86_64-unknown-uefi --no-default-features --features zlib,gzip + - run: cargo build -p zune-jpeg --target x86_64-unknown-uefi --no-default-features --features log + - run: cargo build -p zune-png --target x86_64-unknown-uefi --no-default-features --features log + - run: cargo build -p zune-ppm --target x86_64-unknown-uefi --no-default-features --features log + - run: cargo build -p zune-qoi --target x86_64-unknown-uefi --no-default-features --features log + - run: cargo build -p zune-farbfeld --target x86_64-unknown-uefi --no-default-features --features log + - run: cargo build -p zune-psd --target x86_64-unknown-uefi --no-default-features --features log + - run: cargo build -p zune-bmp --target x86_64-unknown-uefi --no-default-features --features log,rgb_inverse + - run: cargo build -p zune-gif --target x86_64-unknown-uefi --no-default-features --features log + - run: cargo build -p zune-jpegxl --target x86_64-unknown-uefi --no-default-features --features log diff --git a/.gitignore b/.gitignore index cb151c43..64c9a33d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target -**/.DS_Store \ No newline at end of file +**/.DS_Store +Cargo.lock \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index b0ebb051..c4c6435f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,7 @@ version = "0.1.0" edition = "2021" license = "MIT OR Apache-2.0 OR Zlib" repository = "https://github.com/etemesi254/zune-image.git" +rust-version = "1.81.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [workspace] diff --git a/benchmarks/Cargo.toml b/benchmarks/Cargo.toml index cefb6615..6fdf0caf 100644 --- a/benchmarks/Cargo.toml +++ b/benchmarks/Cargo.toml @@ -2,6 +2,7 @@ name = "zune-benches" version = "0.1.0" edition = "2021" +rust-version = "1.81.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/zune-bin/Cargo.toml b/crates/zune-bin/Cargo.toml index c201d650..6ca195b1 100644 --- a/crates/zune-bin/Cargo.toml +++ b/crates/zune-bin/Cargo.toml @@ -3,6 +3,7 @@ name = "zune-bin" version = "0.5.0-rc0" edition = "2021" repository = "https://github.com/etemesi254/zune-image/tree/dev/crates/zune-bin" +rust-version = "1.81.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/zune-bmp/Cargo.toml b/crates/zune-bmp/Cargo.toml index c11a6ed8..df1e0989 100644 --- a/crates/zune-bmp/Cargo.toml +++ b/crates/zune-bmp/Cargo.toml @@ -9,15 +9,17 @@ keywords = ["bmp", "bmp-decoder", "decoder"] categories = ["multimedia::images"] exclude = ["fuzz/*"] description = "A fast BMP decoder" - +rust-version = "1.81.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] log = ["zune-core/log"] -std = ["zune-core/std"] rgb_inverse = [] [dependencies] zune-core = { version = "0.5.0-rc1", path = "../zune-core" } log = "0.4.21" + +[dev-dependencies] +zune-core = { version = "0.5.0-rc1", path = "../zune-core", features = ["std"] } \ No newline at end of file diff --git a/crates/zune-bmp/fuzz/Cargo.toml b/crates/zune-bmp/fuzz/Cargo.toml index 76ba25db..20c9a44f 100644 --- a/crates/zune-bmp/fuzz/Cargo.toml +++ b/crates/zune-bmp/fuzz/Cargo.toml @@ -4,6 +4,7 @@ version = "0.0.0" authors = ["Automatically generated"] publish = false edition = "2018" +rust-version = "1.81.0" [package.metadata] cargo-fuzz = true diff --git a/crates/zune-bmp/src/lib.rs b/crates/zune-bmp/src/lib.rs index 16c26e28..059fe3ae 100644 --- a/crates/zune-bmp/src/lib.rs +++ b/crates/zune-bmp/src/lib.rs @@ -54,9 +54,6 @@ //! use zune_bmp::BmpDecoder; //! // read from a file //! let source = BufReader::new(File::open("./image.bmp").unwrap()); -//! // only run when std is enabled, otherwise zune_core doesn't implement the ZByteReader trait -//! // on File since it doesn't exist in `no_std` land -//! #[cfg(feature = "std")] //! let decoder = BmpDecoder::new(source); //! //! ``` @@ -71,9 +68,8 @@ //! benchmark just in case you think it's slowing you down in any way. //! #![no_std] -#![macro_use] -extern crate alloc; +extern crate alloc; extern crate core; pub use zune_core; diff --git a/crates/zune-capi/Cargo.toml b/crates/zune-capi/Cargo.toml index 6db4655d..b11d149d 100644 --- a/crates/zune-capi/Cargo.toml +++ b/crates/zune-capi/Cargo.toml @@ -3,6 +3,7 @@ name = "zune-capi" version = "0.5.0" edition = "2021" repository = "https://github.com/etemesi254/zune-image/tree/dev/crates/zune-capi" +rust-version = "1.81.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/zune-core/Cargo.toml b/crates/zune-core/Cargo.toml index 0349f68b..d65fcfea 100644 --- a/crates/zune-core/Cargo.toml +++ b/crates/zune-core/Cargo.toml @@ -8,6 +8,7 @@ repository = "https://github.com/etemesi254/zune-image" keywords = ["image"] categories = ["multimedia::images", "multimedia::encoding"] license = "MIT OR Apache-2.0 OR Zlib" +rust-version = "1.81.0" [features] # When present, we can use std facilities to detect @@ -19,4 +20,4 @@ std = [] [dependencies] log = { version = "0.4.17", optional = true } -serde = { version = "1.0.52", optional = true } +serde = { version = "1.0.52", optional = true, default-features = false } diff --git a/crates/zune-core/src/bytestream/reader.rs b/crates/zune-core/src/bytestream/reader.rs index 8d49c4bf..de5ad204 100644 --- a/crates/zune-core/src/bytestream/reader.rs +++ b/crates/zune-core/src/bytestream/reader.rs @@ -453,6 +453,6 @@ where fn read(&mut self, buf: &mut [u8]) -> std::io::Result { use std::io::ErrorKind; self.read_bytes(buf) - .map_err(|e| std::io::Error::new(ErrorKind::Other, format!("{:?}", e))) + .map_err(|e| std::io::Error::new(ErrorKind::Other, alloc::format!("{:?}", e))) } } diff --git a/crates/zune-core/src/bytestream/reader/std_readers.rs b/crates/zune-core/src/bytestream/reader/std_readers.rs index 014d0bd3..730dee26 100644 --- a/crates/zune-core/src/bytestream/reader/std_readers.rs +++ b/crates/zune-core/src/bytestream/reader/std_readers.rs @@ -1,5 +1,6 @@ #![cfg(feature = "std")] +use alloc::vec::Vec; use std::io; use std::io::SeekFrom; diff --git a/crates/zune-core/src/lib.rs b/crates/zune-core/src/lib.rs index 77355f93..4f745031 100644 --- a/crates/zune-core/src/lib.rs +++ b/crates/zune-core/src/lib.rs @@ -43,11 +43,14 @@ //! //! //! -#![cfg_attr(not(feature = "std"), no_std)] -#![macro_use] +#![no_std] + extern crate alloc; extern crate core; +#[cfg(feature = "std")] +extern crate std; + #[cfg(not(feature = "log"))] pub mod log; diff --git a/crates/zune-core/src/options/decoder.rs b/crates/zune-core/src/options/decoder.rs index 6093c70e..177957a2 100644 --- a/crates/zune-core/src/options/decoder.rs +++ b/crates/zune-core/src/options/decoder.rs @@ -450,7 +450,7 @@ impl DecoderOptions { // where we can do runtime check if feature is present #[cfg(feature = "std")] { - if is_x86_feature_detected!("sse2") { + if std::is_x86_feature_detected!("sse2") { return true; } } @@ -483,7 +483,7 @@ impl DecoderOptions { // where we can do runtime check if feature is present #[cfg(feature = "std")] { - if is_x86_feature_detected!("sse3") { + if std::is_x86_feature_detected!("sse3") { return true; } } @@ -515,7 +515,7 @@ impl DecoderOptions { // where we can do runtime check if feature is present #[cfg(feature = "std")] { - if is_x86_feature_detected!("sse4.1") { + if std::is_x86_feature_detected!("sse4.1") { return true; } } @@ -547,7 +547,7 @@ impl DecoderOptions { // where we can do runtime check if feature is present #[cfg(feature = "std")] { - if is_x86_feature_detected!("avx") { + if std::is_x86_feature_detected!("avx") { return true; } } @@ -579,7 +579,7 @@ impl DecoderOptions { // where we can do runtime check if feature is present #[cfg(feature = "std")] { - if is_x86_feature_detected!("avx2") { + if std::is_x86_feature_detected!("avx2") { return true; } } diff --git a/crates/zune-farbfeld/Cargo.toml b/crates/zune-farbfeld/Cargo.toml index 6de4f2e6..df2b5991 100644 --- a/crates/zune-farbfeld/Cargo.toml +++ b/crates/zune-farbfeld/Cargo.toml @@ -8,6 +8,7 @@ homepage = "https://github.com/etemesi254/zune-image/tree/dev/crates/zune-farbfe keywords = ["image"] categories = ["multimedia::images", "multimedia::encoding"] license = "MIT OR Apache-2.0 OR Zlib" +rust-version = "1.81.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] diff --git a/crates/zune-farbfeld/src/lib.rs b/crates/zune-farbfeld/src/lib.rs index 167be93c..01ffeb55 100644 --- a/crates/zune-farbfeld/src/lib.rs +++ b/crates/zune-farbfeld/src/lib.rs @@ -24,7 +24,7 @@ //! //! #![no_std] -#![macro_use] + extern crate alloc; pub use decoder::*; diff --git a/crates/zune-gif/Cargo.toml b/crates/zune-gif/Cargo.toml index 1de83211..ab9550b5 100644 --- a/crates/zune-gif/Cargo.toml +++ b/crates/zune-gif/Cargo.toml @@ -3,6 +3,7 @@ name = "zune-gif" version = "0.5.0-rc0" edition = "2021" repository = "https://github.com/etemesi254/zune-image/tree/dev/crates/zune-gif" +rust-version = "1.81.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/zune-gif/src/decoder.rs b/crates/zune-gif/src/decoder.rs index f1d2e6e1..c0bd0965 100644 --- a/crates/zune-gif/src/decoder.rs +++ b/crates/zune-gif/src/decoder.rs @@ -1,3 +1,5 @@ +use alloc::vec::Vec; + use zune_core::bytestream::{ZByteReaderTrait, ZReader}; use zune_core::log::trace; use zune_core::options::DecoderOptions; diff --git a/crates/zune-gif/src/errors.rs b/crates/zune-gif/src/errors.rs index c2f713a8..0de97b1b 100644 --- a/crates/zune-gif/src/errors.rs +++ b/crates/zune-gif/src/errors.rs @@ -1,5 +1,5 @@ use core::fmt::Debug; -use std::fmt::Formatter; +use core::fmt::Formatter; use zune_core::bytestream::ZByteIoError; @@ -18,7 +18,7 @@ pub enum GifDecoderErrors { TooSmallSize(usize, usize) } impl Debug for GifDecoderErrors { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result { match self { GifDecoderErrors::NotAGif => { writeln!(f, "Not a gif, magic bytes didn't match") diff --git a/crates/zune-gif/src/lib.rs b/crates/zune-gif/src/lib.rs index 622b298d..5f953b6d 100644 --- a/crates/zune-gif/src/lib.rs +++ b/crates/zune-gif/src/lib.rs @@ -1,3 +1,9 @@ +#![no_std] + +#[macro_use] +extern crate alloc; +extern crate core; + mod decoder; mod enums; mod errors; diff --git a/crates/zune-hdr/Cargo.toml b/crates/zune-hdr/Cargo.toml index 2cb35035..a4da8870 100644 --- a/crates/zune-hdr/Cargo.toml +++ b/crates/zune-hdr/Cargo.toml @@ -8,6 +8,7 @@ homepage = "https://github.com/etemesi254/zune-image/tree/dev/crates/zune-hdr" keywords = ["image"] categories = ["multimedia::images", "multimedia::encoding", ] license = "MIT OR Apache-2.0 OR Zlib" +rust-version = "1.81.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] diff --git a/crates/zune-hdr/fuzz/Cargo.toml b/crates/zune-hdr/fuzz/Cargo.toml index 2b4c8d01..9c694c85 100644 --- a/crates/zune-hdr/fuzz/Cargo.toml +++ b/crates/zune-hdr/fuzz/Cargo.toml @@ -4,6 +4,7 @@ version = "0.0.0" authors = ["Automatically generated"] publish = false edition = "2018" +rust-version = "1.81.0" [package.metadata] cargo-fuzz = true diff --git a/crates/zune-image/Cargo.toml b/crates/zune-image/Cargo.toml index 26c1416b..c47945f8 100644 --- a/crates/zune-image/Cargo.toml +++ b/crates/zune-image/Cargo.toml @@ -8,6 +8,7 @@ license = "MIT OR Apache-2.0 OR Zlib" keywords = ["image", "decoder", "encoder", "image-processing"] categories = ["multimedia::images"] description = "An image library, contiaining necessary capabilities to decode, manipulate and encode images" +rust-version = "1.81.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] # Single based image decoders and encoders diff --git a/crates/zune-imageprocs/Cargo.toml b/crates/zune-imageprocs/Cargo.toml index 496f47a7..426fced8 100644 --- a/crates/zune-imageprocs/Cargo.toml +++ b/crates/zune-imageprocs/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0 OR Zlib" keywords = ["image", "image-processing"] categories = ["multimedia::images"] description = "Common image processing routines for zune-image" - +rust-version = "1.81.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/zune-inflate/Cargo.toml b/crates/zune-inflate/Cargo.toml index 8762ee1e..b92b87ad 100644 --- a/crates/zune-inflate/Cargo.toml +++ b/crates/zune-inflate/Cargo.toml @@ -9,15 +9,14 @@ homepage = "https://github.com/etemesi254/zune-image/tree/main/zune-inflate" keywords = ["compression", "inflate", "deflate"] categories = ["compression"] license = "MIT OR Apache-2.0 OR Zlib" +rust-version = "1.81.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] zlib = ["simd-adler32"] gzip = [] -std = ["simd-adler32/std"] - -default = ["zlib", "gzip", "std"] +default = ["zlib", "gzip"] [dependencies] simd-adler32 = { version = "0.3.4", optional = true, default-features = false } diff --git a/crates/zune-inflate/fuzz/Cargo.toml b/crates/zune-inflate/fuzz/Cargo.toml index e761efeb..370983c8 100644 --- a/crates/zune-inflate/fuzz/Cargo.toml +++ b/crates/zune-inflate/fuzz/Cargo.toml @@ -4,6 +4,7 @@ version = "0.0.0" authors = ["Automatically generated"] publish = false edition = "2018" +rust-version = "1.81.0" [package.metadata] cargo-fuzz = true diff --git a/crates/zune-inflate/src/errors.rs b/crates/zune-inflate/src/errors.rs index 1711ab60..fd645213 100644 --- a/crates/zune-inflate/src/errors.rs +++ b/crates/zune-inflate/src/errors.rs @@ -114,5 +114,4 @@ impl Display for InflateDecodeErrors { } } -#[cfg(feature = "std")] -impl std::error::Error for InflateDecodeErrors {} +impl core::error::Error for InflateDecodeErrors {} diff --git a/crates/zune-inflate/src/lib.rs b/crates/zune-inflate/src/lib.rs index 6edc5895..7b2e68d1 100644 --- a/crates/zune-inflate/src/lib.rs +++ b/crates/zune-inflate/src/lib.rs @@ -86,7 +86,8 @@ //! [libdeflater]: https://github.com/adamkewley/libdeflater //! [flate2-rs]: https://github.com/rust-lang/flate2-rs //! -#![cfg_attr(not(feature = "std"), no_std)] +#![no_std] + extern crate alloc; pub use crate::decoder::{DeflateDecoder, DeflateOptions}; diff --git a/crates/zune-jpeg/Cargo.toml b/crates/zune-jpeg/Cargo.toml index fd8797e3..ccc97453 100644 --- a/crates/zune-jpeg/Cargo.toml +++ b/crates/zune-jpeg/Cargo.toml @@ -9,6 +9,7 @@ keywords = ["jpeg", "jpeg-decoder", "decoder"] categories = ["multimedia::images"] exclude = ["/benches/images/*", "/tests/*", "/.idea/*", "/.gradle/*", "/test-images/*", "fuzz/*"] description = "A fast, correct and safe jpeg decoder" +rust-version = "1.81.0" [lints.rust] # Disable feature checker for fuzzing since it's used and cargo doesn't @@ -20,9 +21,8 @@ unexpected_cfgs = { level = "warn", check-cfg = ['cfg(fuzzing)'] } [features] x86 = [] neon = [] -std = ["zune-core/std"] log = ["zune-core/log"] -default = ["x86", "neon", "std"] +default = ["x86", "neon"] [dependencies] diff --git a/crates/zune-jpeg/fuzz/Cargo.toml b/crates/zune-jpeg/fuzz/Cargo.toml index 2574dcde..d3983d16 100644 --- a/crates/zune-jpeg/fuzz/Cargo.toml +++ b/crates/zune-jpeg/fuzz/Cargo.toml @@ -4,6 +4,7 @@ version = "0.0.0" authors = ["Automatically generated"] publish = false edition = "2018" +rust-version = "1.81.0" [package.metadata] cargo-fuzz = true diff --git a/crates/zune-jpeg/src/errors.rs b/crates/zune-jpeg/src/errors.rs index 1410961e..461df425 100644 --- a/crates/zune-jpeg/src/errors.rs +++ b/crates/zune-jpeg/src/errors.rs @@ -53,8 +53,7 @@ pub enum DecodeErrors { IoErrors(ZByteIoError) } -#[cfg(feature = "std")] -impl std::error::Error for DecodeErrors {} +impl core::error::Error for DecodeErrors {} impl From<&'static str> for DecodeErrors { fn from(data: &'static str) -> Self { diff --git a/crates/zune-jpeg/src/lib.rs b/crates/zune-jpeg/src/lib.rs index 59143bec..c91605b2 100644 --- a/crates/zune-jpeg/src/lib.rs +++ b/crates/zune-jpeg/src/lib.rs @@ -102,8 +102,9 @@ // no_std compatibility #![deny(clippy::std_instead_of_alloc, clippy::alloc_instead_of_core)] #![cfg_attr(not(any(feature = "x86", feature = "neon")), forbid(unsafe_code))] -#![cfg_attr(not(feature = "std"), no_std)] -#![macro_use] +#![no_std] + +#[macro_use] extern crate alloc; extern crate core; diff --git a/crates/zune-jpegxl/Cargo.toml b/crates/zune-jpegxl/Cargo.toml index 8d51d404..dee9b8fd 100644 --- a/crates/zune-jpegxl/Cargo.toml +++ b/crates/zune-jpegxl/Cargo.toml @@ -9,6 +9,7 @@ keywords = ["jpeg-xl", "jpeg-xl-decoder", "decoder", "jxl"] categories = ["multimedia::images"] exclude = [] description = "A simple, fast and fully safe modular jxl encoder" +rust-version = "1.81.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -17,7 +18,7 @@ description = "A simple, fast and fully safe modular jxl encoder" zune-core = { version = "^0.5.0-rc0", path = "../zune-core" } [features] -threads = [] +threads = ["std"] std = [] log = ["zune-core/log"] default = ["threads", "std"] diff --git a/crates/zune-jpegxl/src/errors.rs b/crates/zune-jpegxl/src/errors.rs index ce4b5eea..84aa5820 100644 --- a/crates/zune-jpegxl/src/errors.rs +++ b/crates/zune-jpegxl/src/errors.rs @@ -90,5 +90,4 @@ impl core::fmt::Display for JxlEncodeErrors { } } -#[cfg(feature = "std")] -impl std::error::Error for JxlEncodeErrors {} +impl core::error::Error for JxlEncodeErrors {} diff --git a/crates/zune-jpegxl/src/lib.rs b/crates/zune-jpegxl/src/lib.rs index 7ce5855c..f7e658e4 100644 --- a/crates/zune-jpegxl/src/lib.rs +++ b/crates/zune-jpegxl/src/lib.rs @@ -81,11 +81,14 @@ //! ``` //! #![forbid(unsafe_code)] -#![cfg_attr(not(feature = "std"), no_std)] -#![macro_use] +#![no_std] + extern crate alloc; extern crate core; +#[cfg(feature = "std")] +extern crate std; + pub use encoder::JxlSimpleEncoder; pub use errors::JxlEncodeErrors; diff --git a/crates/zune-opencl/Cargo.toml b/crates/zune-opencl/Cargo.toml index 49771e59..9264d78d 100644 --- a/crates/zune-opencl/Cargo.toml +++ b/crates/zune-opencl/Cargo.toml @@ -3,6 +3,7 @@ name = "zune-opencl" version = "0.4.0" edition = "2021" repository = "https://github.com/etemesi254/zune-image/tree/dev/crates/zune-opencl" +rust-version = "1.81.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/zune-png/Cargo.toml b/crates/zune-png/Cargo.toml index 7f33cec6..06676bc7 100644 --- a/crates/zune-png/Cargo.toml +++ b/crates/zune-png/Cargo.toml @@ -9,7 +9,7 @@ keywords = ["png", "png-decoder", "decoder"] categories = ["multimedia::images"] exclude = ["/benches/images/*", "/tests/*", "/.idea/*", "/.gradle/*", "/test-images/*", "fuzz/*"] description = "A fast, correct and safe png decoder" - +rust-version = "1.81.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/zune-png/fuzz/Cargo.toml b/crates/zune-png/fuzz/Cargo.toml index d53edaae..865d48b8 100644 --- a/crates/zune-png/fuzz/Cargo.toml +++ b/crates/zune-png/fuzz/Cargo.toml @@ -4,6 +4,7 @@ version = "0.0.0" authors = ["Automatically generated"] publish = false edition = "2018" +rust-version = "1.81.0" [package.metadata] cargo-fuzz = true diff --git a/crates/zune-png/src/error.rs b/crates/zune-png/src/error.rs index 399c4f17..4566575f 100644 --- a/crates/zune-png/src/error.rs +++ b/crates/zune-png/src/error.rs @@ -39,8 +39,7 @@ impl Display for PngDecodeErrors { } } -#[cfg(feature = "std")] -impl std::error::Error for PngDecodeErrors {} +impl core::error::Error for PngDecodeErrors {} impl Debug for PngDecodeErrors { fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result { diff --git a/crates/zune-png/src/filters/sse4.rs b/crates/zune-png/src/filters/sse4.rs index e2bb0c98..2838d6db 100644 --- a/crates/zune-png/src/filters/sse4.rs +++ b/crates/zune-png/src/filters/sse4.rs @@ -191,7 +191,7 @@ unsafe fn de_filter_sub_generic_sse2(raw: &[u8], current: &mu pub fn de_filter_sub_sse2(raw: &[u8], current: &mut [u8]) { #[cfg(feature = "std")] { - if !is_x86_feature_detected!("sse2") { + if !std::is_x86_feature_detected!("sse2") { panic!("Internal error, calling platform specific function where not supported") } } @@ -268,7 +268,7 @@ unsafe fn de_filter_paeth_sse41_inner( pub fn de_filter_paeth_sse41(prev_row: &[u8], raw: &[u8], current: &mut [u8]) { #[cfg(feature = "std")] { - if !is_x86_feature_detected!("sse4.1") { + if !std::is_x86_feature_detected!("sse4.1") { panic!("Internal error, calling platform specific function where not supported") } } @@ -325,7 +325,7 @@ unsafe fn defilter_avg_sse2_inner( pub fn defilter_avg_sse(prev_row: &[u8], raw: &[u8], current: &mut [u8]) { #[cfg(feature = "std")] { - if !is_x86_feature_detected!("sse2") { + if !std::is_x86_feature_detected!("sse2") { panic!("Internal error, calling platform specific function where not supported") } } diff --git a/crates/zune-png/src/lib.rs b/crates/zune-png/src/lib.rs index 0b086744..db7848e8 100644 --- a/crates/zune-png/src/lib.rs +++ b/crates/zune-png/src/lib.rs @@ -160,11 +160,15 @@ //! //! //! -#![cfg_attr(not(feature = "std"), no_std)] +#![no_std] #![allow(clippy::op_ref, clippy::identity_op)] + extern crate alloc; extern crate core; +#[cfg(feature = "std")] +extern crate std; + #[cfg(feature = "std")] pub use apng::post_process_image; pub use apng::{BlendOp, DisposeOp}; diff --git a/crates/zune-png/src/utils.rs b/crates/zune-png/src/utils.rs index 1633e4dc..2419e796 100644 --- a/crates/zune-png/src/utils.rs +++ b/crates/zune-png/src/utils.rs @@ -36,12 +36,12 @@ fn convert_be_to_le_u16(out: &mut [u8], _use_sse4: bool) { #[cfg(feature = "std")] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { - if _use_sse4 && is_x86_feature_detected!("avx2") { + if _use_sse4 && std::is_x86_feature_detected!("avx2") { unsafe { return avx::convert_be_to_ne_avx(out); }; } - if _use_sse4 && is_x86_feature_detected!("ssse3") { + if _use_sse4 && std::is_x86_feature_detected!("ssse3") { unsafe { return sse::convert_be_to_ne_sse4(out); } diff --git a/crates/zune-ppm/Cargo.toml b/crates/zune-ppm/Cargo.toml index 647b2a21..babcf2ff 100644 --- a/crates/zune-ppm/Cargo.toml +++ b/crates/zune-ppm/Cargo.toml @@ -9,7 +9,7 @@ keywords = ["ppm", "ppm-decoder", "decoder"] categories = ["multimedia::images"] exclude = ["fuzz/*"] description = "Portable Pixmap and Portable Floatmap Format Decoder and Encoder" - +rust-version = "1.81.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/zune-ppm/fuzz/Cargo.toml b/crates/zune-ppm/fuzz/Cargo.toml index 9a8aa69f..a96a8e58 100644 --- a/crates/zune-ppm/fuzz/Cargo.toml +++ b/crates/zune-ppm/fuzz/Cargo.toml @@ -4,6 +4,7 @@ version = "0.0.0" authors = ["Automatically generated"] publish = false edition = "2018" +rust-version = "1.81.0" [package.metadata] cargo-fuzz = true diff --git a/crates/zune-psd/Cargo.toml b/crates/zune-psd/Cargo.toml index 7ebd476d..d648c510 100644 --- a/crates/zune-psd/Cargo.toml +++ b/crates/zune-psd/Cargo.toml @@ -9,7 +9,7 @@ keywords = ["psd", "psd-decoder", "decoder"] categories = ["multimedia::images"] exclude = ["fuzz/*"] description = "Photoshop Simple PSD decoder" - +rust-version = "1.81.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/zune-psd/fuzz/Cargo.toml b/crates/zune-psd/fuzz/Cargo.toml index 45412786..ee34a711 100644 --- a/crates/zune-psd/fuzz/Cargo.toml +++ b/crates/zune-psd/fuzz/Cargo.toml @@ -4,6 +4,7 @@ version = "0.0.0" authors = ["Automatically generated"] publish = false edition = "2018" +rust-version = "1.81.0" [package.metadata] cargo-fuzz = true diff --git a/crates/zune-python/Cargo.toml b/crates/zune-python/Cargo.toml index 3521d173..4830eb3c 100644 --- a/crates/zune-python/Cargo.toml +++ b/crates/zune-python/Cargo.toml @@ -3,6 +3,7 @@ name = "zune-python" version = "0.4.0" edition = "2021" repository = "https://github.com/etemesi254/zune-image/tree/dev/crates/zune-python" +rust-version = "1.81.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] diff --git a/crates/zune-qoi/Cargo.toml b/crates/zune-qoi/Cargo.toml index a95e2d89..b2bd71e4 100644 --- a/crates/zune-qoi/Cargo.toml +++ b/crates/zune-qoi/Cargo.toml @@ -9,12 +9,11 @@ keywords = ["qoi", "qoi-decoder", "decoder", "qoi-encoder", "encoder"] categories = ["multimedia::images"] exclude = ["fuzz/*"] description = "Quite Ok Image (QOI) decoder and encoder part of the zune-image family" - +rust-version = "1.81.0" [features] log = ["zune-core/log"] -std = ["zune-core/std"] -default = ["std", "log"] +default = ["log"] [dependencies] zune-core = { path = "../zune-core", version = "^0.5.0-rc0" } diff --git a/crates/zune-qoi/fuzz/Cargo.toml b/crates/zune-qoi/fuzz/Cargo.toml index 6a625dcf..a66e4254 100644 --- a/crates/zune-qoi/fuzz/Cargo.toml +++ b/crates/zune-qoi/fuzz/Cargo.toml @@ -4,6 +4,7 @@ version = "0.0.0" authors = ["Automatically generated"] publish = false edition = "2018" +rust-version = "1.81.0" [package.metadata] cargo-fuzz = true diff --git a/crates/zune-qoi/src/errors.rs b/crates/zune-qoi/src/errors.rs index 0b437e4b..9b0a12d7 100644 --- a/crates/zune-qoi/src/errors.rs +++ b/crates/zune-qoi/src/errors.rs @@ -147,11 +147,9 @@ impl Display for QoiErrors { } } -#[cfg(feature = "std")] -impl std::error::Error for QoiEncodeErrors {} +impl core::error::Error for QoiEncodeErrors {} -#[cfg(feature = "std")] -impl std::error::Error for QoiErrors {} +impl core::error::Error for QoiErrors {} impl From for QoiEncodeErrors { fn from(value: ZByteIoError) -> Self { diff --git a/crates/zune-qoi/src/lib.rs b/crates/zune-qoi/src/lib.rs index 6e687d54..707e8887 100644 --- a/crates/zune-qoi/src/lib.rs +++ b/crates/zune-qoi/src/lib.rs @@ -17,8 +17,8 @@ //! ## `no_std` //! You can use `no_std` with alloc feature to compile for `no_std` endpoints -#![cfg_attr(not(feature = "std"), no_std)] -#![macro_use] +#![no_std] + extern crate alloc; extern crate core; diff --git a/crates/zune-wasm/Cargo.toml b/crates/zune-wasm/Cargo.toml index 41ee624a..fe22fd50 100644 --- a/crates/zune-wasm/Cargo.toml +++ b/crates/zune-wasm/Cargo.toml @@ -6,6 +6,7 @@ authors = ["caleb "] edition = "2021" license = "MIT OR Apache-2.0 OR Zlib" repository = "https://github.com/etemesi254/zune-image/tree/dev/crates/zune-wasm" +rust-version = "1.81.0" [lib] crate-type = ["cdylib", "rlib"] diff --git a/tests/Cargo.toml b/tests/Cargo.toml index 44d527f4..9aa233e7 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -2,6 +2,7 @@ name = "zune-tests" version = "0.1.0" edition = "2021" +rust-version = "1.81.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html