From f195cb7e13ce89db7bf1d5cbcd107c342e57aff5 Mon Sep 17 00:00:00 2001 From: Andre Bogus Date: Fri, 11 Jan 2019 22:34:43 +0100 Subject: [PATCH] =?UTF-8?q?Update=20dependencies=20=E2=80=93=20this=20now?= =?UTF-8?q?=20requires=20at=20least=20Rust=201.24.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 2 +- Cargo.toml | 10 +++++----- README.md | 5 ++++- benches/bench.rs | 6 ++++-- tests/check.rs | 6 ++++-- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index c4b9392..055fca3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: rust sudo: false cache: cargo rust: - - 1.20.0 + - 1.27.2 - stable - beta - nightly diff --git a/Cargo.toml b/Cargo.toml index 196e2f2..92b3e95 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ authors = ["Andre Bogus ", "Joshua Landau "] description = "count occurrences of a given byte, or the number of UTF-8 code points, in a byte slice, fast" name = "bytecount" -version = "0.4.0" +version = "0.5.0" license = "Apache-2.0/MIT" repository = "https://github.com/llogiq/bytecount" categories = ["algorithms", "no-std"] @@ -21,12 +21,12 @@ runtime-dispatch-simd = [] html_report = [] [dependencies] -packed_simd = { version = "0.3.0", optional = true } +packed_simd = { version = "0.3.1", optional = true } [dev-dependencies] -quickcheck = "0.6" -rand = "0.4" -criterion = { version = "0.2.4", default-features = false } +quickcheck = "0.8" +rand = "0.6" +criterion = { version = "0.2.7", default-features = false } [[bench]] name = "bench" diff --git a/README.md b/README.md index c13f795..eece310 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ The [newlinebench](https://github.com/llogiq/newlinebench) repository has furthe To use bytecount in your crate, if you have [cargo-edit](https://github.com/killercup/cargo-edit), just type `cargo add bytecount` in a terminal with the crate root as the current path. Otherwise you can manually edit your -`Cargo.toml` to add `bytecount = 0.4.0` to your `[dependencies]` section. +`Cargo.toml` to add `bytecount = 0.5.0` to your `[dependencies]` section. In your crate root (`lib.rs` or `main.rs`, depending on if you are writing a library or application), add `extern crate bytecount;`. Now you can simply use @@ -64,6 +64,9 @@ RUSTFLAGS="-C target-cpu=native" cargo build --release The scalar algorithm is explained in depth [here](https://llogiq.github.io/2016/09/27/count.html). +**Note: Versions until 0.4.0 worked with Rust as of 1.20.0. Version 0.5.0 and later requires Rust 1.26 or later, +and at least 1.27.2 to use SIMD.** + ## License Licensed under either of at your discretion: diff --git a/benches/bench.rs b/benches/bench.rs index 5cda0f6..85d04db 100644 --- a/benches/bench.rs +++ b/benches/bench.rs @@ -5,7 +5,7 @@ extern crate bytecount; use std::env; use std::time::Duration; -use rand::Rng; +use rand::RngCore; use criterion::{Bencher, Criterion, ParameterizedBenchmark}; use bytecount::{ @@ -14,7 +14,9 @@ use bytecount::{ }; fn random_bytes(len: usize) -> Vec { - rand::thread_rng().gen_iter::().take(len).collect::>() + let mut result = vec![0; len]; + rand::thread_rng().fill_bytes(&mut result); + result } static COUNTS : &[usize] = &[0, 10, 20, 30, 40, 50, 60, 70, 80, 90, diff --git a/tests/check.rs b/tests/check.rs index 819a530..e45e9a4 100644 --- a/tests/check.rs +++ b/tests/check.rs @@ -8,10 +8,12 @@ use bytecount::{ count, naive_count, num_chars, naive_num_chars, }; -use rand::Rng; +use rand::RngCore; fn random_bytes(len: usize) -> Vec { - rand::thread_rng().gen_iter::().take(len).collect::>() + let mut result = vec![0; len]; + rand::thread_rng().fill_bytes(&mut result); + result } quickcheck! {