Memchr: Optimized string search routines for Rust
github.com·3d·
Discuss: Hacker News
Flag this post

memchr

This library provides heavily optimized routines for string search primitives.

Dual-licensed under MIT or the UNLICENSE.

Documentation

https://docs.rs/memchr

Overview

  • The top-level module provides routines for searching for 1, 2 or 3 bytes in the forward or reverse direction. When searching for more than one byte, positions are considered a match if the byte at that position matches any of the bytes.
  • The memmem sub-module provides forward and reverse substring search routines.

In all such cases, routines operate on &[u8] without regard to encoding. This is exactly what you want when searching either UTF-8 or arbitrary bytes.

Compiling without the standard library

memchr links to the standard …

Similar Posts

Loading similar posts...