Patterns
no_std compatible pattern scan library using simd
Install / Use
/learn @greaka/PatternsREADME
Pattern matching library
Allows you to search for a pattern within data via an iterator interface. This library uses the core::simd abstraction and is fully no_std, no alloc. Additionally, all panics are documented and are limited to pattern creation.
Usage
use patterns::Pattern;
let data = [0_u8; 1_000_00];
// Allows . and ? as wildcard.
// Any number of wildcard characters between spaces is considered a wildcard byte.
let pattern: Pattern = "01 02 00 ? 59 ff".parse().unwrap();
let mut iterator = pattern.matches(&data);
for _found in iterator {
// use _found
}
More advanced use cases may also specify a target alignment required to match, or the LANE size with which to search:
use patterns::Pattern;
static PATTERN: Pattern<4, 64> = Pattern::new("00 01 02 . ff");
Limitations
- The maximum amount of bytes supported inside a pattern are determined by the chosen 2nd const parameter (default 64)
- Target alignment of the pattern to search for must be less or equal to that 2nd const parameter
- The pointer of data to search through must adhere to these bounds:
data.as_ptr() - 64 >[usize::MIN]data.as_ptr() + data.len() + 64 <[usize::MAX]
In practice, it's impossible to be outside of these bounds when using an OS.
Related Skills
node-connect
345.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
106.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
345.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
345.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
