gecko-dev/third_party/rust/memchr
Manish Goregaokar cd6c97ea60 Bug 1336607 - Update vendored Rust sources to include geckolib dependencies; r=froydnj
MozReview-Commit-ID: BOgu41N351y

--HG--
rename : third_party/rust/serde/.cargo-checksum.json => third_party/rust/serde-0.8.23/.cargo-checksum.json
rename : third_party/rust/serde/Cargo.toml => third_party/rust/serde-0.8.23/Cargo.toml
rename : third_party/rust/serde/src/bytes.rs => third_party/rust/serde-0.8.23/src/bytes.rs
rename : third_party/rust/serde/src/de/impls.rs => third_party/rust/serde-0.8.23/src/de/impls.rs
rename : third_party/rust/serde/src/de/mod.rs => third_party/rust/serde-0.8.23/src/de/mod.rs
rename : third_party/rust/serde/src/de/value.rs => third_party/rust/serde-0.8.23/src/de/value.rs
rename : third_party/rust/serde/src/error.rs => third_party/rust/serde-0.8.23/src/error.rs
rename : third_party/rust/serde/src/lib.rs => third_party/rust/serde-0.8.23/src/lib.rs
rename : third_party/rust/serde/src/macros.rs => third_party/rust/serde-0.8.23/src/macros.rs
rename : third_party/rust/serde/src/ser/impls.rs => third_party/rust/serde-0.8.23/src/ser/impls.rs
rename : third_party/rust/serde/src/ser/mod.rs => third_party/rust/serde-0.8.23/src/ser/mod.rs
extra : rebase_source : d015147c7a6c01b34c5a1abf035d71f8ecfe0c12
2017-02-10 12:19:18 -08:00
..
benches
src
.cargo-checksum.json
.cargo-ok
.gitignore
.travis.yml
COPYING
Cargo.toml
LICENSE-MIT
Makefile
README.md
UNLICENSE
appveyor.yml
ctags.rust
session.vim

README.md

This crate provides a safe interface libc's memchr and memrchr. This crate also provides fallback implementations when either function is unavailable.

Build status Build status

Dual-licensed under MIT or the UNLICENSE.

Documentation

https://docs.rs/memchr

no_std

memchr links to the standard library by default, but you can disable the use_std feature if you want to use it in a #![no_std] crate:

[dependencies]
memchr = { version = "1.0", default-features = false }

Performance

On my system (Linux/amd64), memchr is about an order of magnitude faster than the more idiomatic haystack.iter().position(|&b| b == needle):

test iterator          ... bench:       5,280 ns/iter (+/- 13) = 1893 MB/s
test iterator_reversed ... bench:       5,271 ns/iter (+/- 7) = 1897 MB/s
test libc_memchr       ... bench:         202 ns/iter (+/- 0) = 49504 MB/s
test libc_memrchr      ... bench:         197 ns/iter (+/- 1) = 50761 MB/s