[][src]Crate memchr

The memchr crate provides heavily optimized routines for searching bytes.

The memchr function is traditionally provided by libc, however, the performance of memchr can vary significantly depending on the specific implementation of libc that is used. They can range from manually tuned Assembly implementations (like that found in GNU's libc) all the way to non-vectorized C implementations (like that found in MUSL).

To smooth out the differences between implementations of libc, at least on x86_64 for Rust 1.27+, this crate provides its own implementation of memchr that should perform competitively with the one found in GNU's libc. The implementation is in pure Rust and has no dependency on a C compiler or an Assembler.

Additionally, GNU libc also provides an extension, memrchr. This crate provides its own implementation of memrchr as well, on top of memchr2, memchr3, memrchr2 and memrchr3. The difference between memchr and memchr2 is that that memchr2 permits finding all occurrences of two bytes instead of one. Similarly for memchr3.

Structs

Memchr

An iterator for memchr.

Memchr2

An iterator for memchr2.

Memchr3

An iterator for memchr3.

Functions

memchr

Search for the first occurrence of a byte in a slice.

memchr2

Like memchr, but searches for two bytes instead of one.

memchr2_iter

An iterator over all occurrences of the needles in a haystack.

memchr3

Like memchr, but searches for three bytes instead of one.

memchr3_iter

An iterator over all occurrences of the needles in a haystack.

memchr_iter

An iterator over all occurrences of the needle in a haystack.

memrchr

Search for the last occurrence of a byte in a slice.

memrchr2

Like memrchr, but searches for two bytes instead of one.

memrchr2_iter

An iterator over all occurrences of the needles in a haystack, in reverse.

memrchr3

Like memrchr, but searches for three bytes instead of one.

memrchr3_iter

An iterator over all occurrences of the needles in a haystack, in reverse.

memrchr_iter

An iterator over all occurrences of the needle in a haystack, in reverse.