Fix deprecated usage of ONCE_INIT

Once::new() was added in Rust 1.2.0 and ONCE_INIT has been deprecated as of
Rust 1.38. Also updated the README example.

cargo test passes
This commit is contained in:
Nathan Fiedler
2019-10-31 08:45:46 -07:00
parent 8e531f5611
commit 66397e6abc
2 changed files with 4 additions and 4 deletions

View File

@ -50,11 +50,11 @@ MagickWand has some global state that needs to be initialized prior to using the
```rust
use magick_rust::{MagickWand, magick_wand_genesis};
use std::sync::{Once, ONCE_INIT};
use std::sync::Once;
// Used to make sure MagickWand is initialized exactly once. Note that we
// do not bother shutting down, we simply exit when we're done.
static START: Once = ONCE_INIT;
static START: Once = Once::new();
fn resize() -> Result<Vec<u8>, &'static str> {
START.call_once(|| {