Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 01-Sep-2019 | - | ||||
benches/ | H | 01-Sep-2019 | - | 118 | 104 | |
ci/ | H | 01-Sep-2019 | - | 21 | 10 | |
src/ | H | 01-Sep-2019 | - | 1,063 | 825 | |
.cargo-checksum.json | H A D | 01-Sep-2019 | 1.1 KiB | 1 | 1 | |
.travis.yml | H A D | 01-Sep-2019 | 116 | 11 | 10 | |
COPYING | H A D | 01-Sep-2019 | 126 | 4 | 2 | |
Cargo.toml | H A D | 01-Sep-2019 | 1.3 KiB | 46 | 41 | |
LICENSE-MIT | H A D | 01-Sep-2019 | 1.1 KiB | 22 | 17 | |
Makefile | H A D | 01-Sep-2019 | 253 | 15 | 11 | |
README.md | H A D | 01-Sep-2019 | 1.3 KiB | 37 | 25 | |
UNLICENSE | H A D | 01-Sep-2019 | 1.2 KiB | 25 | 20 | |
appveyor.yml | H A D | 01-Sep-2019 | 559 | 21 | 20 | |
ctags.rust | H A D | 01-Sep-2019 | 902 | 12 | 11 | |
session.vim | H A D | 01-Sep-2019 | 56 | 2 | 1 |
README.md
1This crate provides a safe interface `libc`'s `memchr` and `memrchr`. 2This crate also provides fallback implementations when either function is 3unavailable. 4 5[![Build status](https://api.travis-ci.org/BurntSushi/rust-memchr.png)](https://travis-ci.org/BurntSushi/rust-memchr) 6[![Build status](https://ci.appveyor.com/api/projects/status/8i9484t8l4w7uql0/branch/master?svg=true)](https://ci.appveyor.com/project/BurntSushi/rust-memchr/branch/master) 7[![](http://meritbadge.herokuapp.com/memchr)](https://crates.io/crates/memchr) 8 9Dual-licensed under MIT or the [UNLICENSE](http://unlicense.org). 10 11 12### Documentation 13 14[https://docs.rs/memchr](https://docs.rs/memchr) 15 16### no_std 17 18memchr links to the standard library by default, but you can disable the 19`use_std` feature if you want to use it in a `#![no_std]` crate: 20 21```toml 22[dependencies] 23memchr = { version = "2", default-features = false } 24``` 25 26### Performance 27 28On my system (Linux/amd64), `memchr` is about an order of magnitude faster than 29the more idiomatic `haystack.iter().position(|&b| b == needle)`: 30 31``` 32test iterator ... bench: 5,280 ns/iter (+/- 13) = 1893 MB/s 33test iterator_reversed ... bench: 5,271 ns/iter (+/- 7) = 1897 MB/s 34test libc_memchr ... bench: 202 ns/iter (+/- 0) = 49504 MB/s 35test libc_memrchr ... bench: 197 ns/iter (+/- 1) = 50761 MB/s 36``` 37