Skip to content

Commit

Permalink
Merge pull request #52 from llogiq/update
Browse files Browse the repository at this point in the history
Update dependencies – this now requires at least Rust 1.27.2
  • Loading branch information
llogiq authored Jan 14, 2019
2 parents 2bc5cba + f195cb7 commit 364ae05
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language: rust
sudo: false
cache: cargo
rust:
- 1.20.0
- 1.27.2
- stable
- beta
- nightly
Expand Down
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
authors = ["Andre Bogus <bogusandre@gmail.de>", "Joshua Landau <joshua@landau.ws>"]
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"]
Expand All @@ -22,12 +22,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"
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 4 additions & 2 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand All @@ -14,7 +14,9 @@ use bytecount::{
};

fn random_bytes(len: usize) -> Vec<u8> {
rand::thread_rng().gen_iter::<u8>().take(len).collect::<Vec<_>>()
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,
Expand Down
6 changes: 4 additions & 2 deletions tests/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u8> {
rand::thread_rng().gen_iter::<u8>().take(len).collect::<Vec<_>>()
let mut result = vec![0; len];
rand::thread_rng().fill_bytes(&mut result);
result
}

quickcheck! {
Expand Down

0 comments on commit 364ae05

Please sign in to comment.