Expand description
memx
is a Rust library that provides a set of functions for memory manipulation, similar to the standard C library’s <string.h>
, but implemented in pure Rust and optimized for performance.
§Features
- A rich set of memory search, comparison, and manipulation functions.
- Optimized implementations for x86 and x86-64 architectures using SSE2 and AVX2.
no_std
compatibility for use in embedded systems and other resource-constrained environments.- A full suite of iterators for all search functions, providing an idiomatic Rust interface.
Modules§
Structs§
- Range
Error - used by memcpy()
Functions§
- memchr
- This mimics
libc::memchr()
, same asbuf.iter().position(|&x| x == by1)
. - memchr_
dbl - This is same as
buf.iter().position(|&x| x == by1 || x == by2)
. - memchr_
qpl - This is same as
buf.iter().position(|&x| x == by1 || x == by2 || x == by3 || x == by4)
. - memchr_
tpl - This is same as
buf.iter().position(|&x| x == by1 || x == by2 || x == by3)
. - memcmp
- This mimics
libc::memcmp()
, same asa.cmp(&b)
. - memcpy
- This mimics
libc::memcpy()
, same asdst = src
. - memeq
- This mimics
libc::bcmp()
, same asa == b
. - memmem
- This mimics
libc::memmem()
, same as(haystack as &str).find(needle as &str)
orhaystack.windows(needle.len()).position(|window| window == needle)
. - memnechr
- This is same as
buf.iter().position(|&x| x != by1)
, not included libc. - memnechr_
dbl - This is same as
buf.iter().position(|&x| x != by1 && x != by2)
, not included libc. - memnechr_
qpl - This is same as
buf.iter().position(|&x| x != by1 && x != by2 && x != by3 && x != by4)
, not included libc. - memnechr_
tpl - This is same as
buf.iter().position(|&x| x != by1 && x != by2 && x != by3)
, not included libc. - memrchr
- This mimics
libc::memrchr()
, same asbuf.iter().rposition(|&x| x == by1)
. - memrchr_
dbl - This is same as
buf.iter().rposition(|&x| x == by1 || x == by2)
. - memrchr_
qpl - This is same as
buf.iter().rposition(|&x| x == by1 || x == by2 || x == by3 || x == by4)
. - memrchr_
tpl - This is same as
buf.iter().rposition(|&x| x == by1 || x == by2 || x == by3)
. - memrmem
- This mimics
libc::memrmem()
, same as(haystack as &str).rfind(needle as &str)
orhaystack.windows(needle.len()).rposition(|window| window == needle)
. - memrnechr
- This is same as
buf.iter().rposition(|&x| x != by1)
, not included libc. - memrnechr_
dbl - This is same as
buf.iter().rposition(|&x| x != by1 && x != by2)
, not included libc. - memrnechr_
qpl - This is same as
buf.iter().rposition(|&x| x != by1 && x != by2 && x != by3 && x != by4)
, not included libc. - memrnechr_
tpl - This is same as
buf.iter().rposition(|&x| x != by1 && x != by2 && x != by3)
, not included libc. - memset
- This mimics
libc::memset()
, same asbuf.fill(c)
.