diff --git a/CHANGELOG.md b/CHANGELOG.md index b6d597c..1fe9c16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,13 @@ This project adheres to [Semantic Versioning](http://semver.org/). This file follows the convention described at [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). -## [Unreleased] +## [0.11.0] - 2019-04-17 ### Changed - Updated `bindgen` dependency to 0.31 release and fixed compiler issues. Enum definitions changed again, default in bindgen is different now, and using `default_enum_style()` caused endless compiler errors. +- Made `get_exception_type()`, `get_exception()`, and `clear_exception()` + on the various wand implementations. ## [0.10.0] - 2018-08-11 ### Added diff --git a/Cargo.toml b/Cargo.toml index 8216675..494ed13 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "magick_rust" -version = "0.10.0" +version = "0.11.0" authors = ["Nathan Fiedler "] description = "Selection of Rust bindings for the ImageMagick library." homepage = "https://github.com/nlfiedler/magick-rust" diff --git a/README.md b/README.md index 7250d6a..880fa2e 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ A somewhat safe Rust interface to the [ImageMagick](http://www.imagemagick.org/) - Linux may require building ImageMagick from source, see the `Dockerfile` for an example - Windows: download `*-dll` [installer](https://www.imagemagick.org/script/download.php#windows). Only MSVC version available. When installing, check the checkbox "Install development headers and libraries for C and C++". * [Clang](https://clang.llvm.org) (version 3.5 or higher) - - Or whatever version is dictated by [rust-bindgen](https://github.com/servo/rust-bindgen) + - Or whatever version is dictated by [rust-bindgen](https://github.com/rust-lang/rust-bindgen) * Windows requires MSVC toolchain * Optionally `pkg-config`, to facilitate linking with ImageMagick. Or you can set linker parameters via environment variables. @@ -69,6 +69,10 @@ fn resize() -> Result, &'static str> { Writing the image to a file rather than an in-memory blob is done by replacing the call to `write_image_blob()` with `write_image()`, which takes a string for the path to the file. +## Frequent API Changes + +Because rust-bindgen changes from time to time, and is very difficult to use for a library as large as ImageMagick, the API of this crate may experience dramatic mood swings. Typically this pain manifests itself in the way the enums are represented. I am deeply sorry for this pain. Hopefully someone smarter than me can fix it some day. Pull requests are welcome. + ## Contributing There are still many missing functions, so if you find there is something you would like to see added to this library, feel free to file an issue. Even better, fork the repo, and write the thin wrapper necessary to expose the MagickWand function. For getters and setters this is often very easy, just add a row to the table in `wand/magick.rs`, and it will work with no additional coding. Tests are optional, as this crate is basically a thin wrapper around code that is assumed to be thoroughly tested already. If you make a change that you want to contribute, please feel free to submit a pull request. diff --git a/src/wand/macros.rs b/src/wand/macros.rs index 10db8d0..c1c17b5 100644 --- a/src/wand/macros.rs +++ b/src/wand/macros.rs @@ -33,18 +33,18 @@ macro_rules! wand_common { unsafe { ::bindings::$clear_wand(self.wand) } } - fn clear_exception(&mut self) -> Result<(), &'static str> { + pub fn clear_exception(&mut self) -> Result<(), &'static str> { match unsafe { ::bindings::$clear_exc(self.wand) } { ::bindings::MagickBooleanType_MagickTrue => Ok(()), _ => Err(concat!("failed to clear", stringify!($wand), "exception")), } } - fn get_exception_type(&self) -> ::bindings::ExceptionType { + pub fn get_exception_type(&self) -> ::bindings::ExceptionType { unsafe { ::bindings::$get_exc_type(self.wand) } } - fn get_exception(&self) -> Result<(String, ::bindings::ExceptionType), &'static str> { + pub fn get_exception(&self) -> Result<(String, ::bindings::ExceptionType), &'static str> { let mut severity: ::bindings::ExceptionType = ::bindings::ExceptionType_UndefinedException; // TODO: memory management