Crates.io | vectorscan |
lib.rs | vectorscan |
version | 0.1.2 |
source | src |
created_at | 2023-12-21 10:16:58.519077 |
updated_at | 2024-01-20 03:04:19.506116 |
description | A Rust wrapper for Vectorscan |
homepage | https://github.com/thaind0/vectorscan-rs |
repository | https://github.com/thaind0/vectorscan-rs |
max_upload_size | |
id | 1076660 |
size | 11,399,243 |
vectorscan-rs
This crate implements minimal Rust bindings to the Vectorscan fork of Hyperscan, the high-performance regular expression engine.
This crate builds a vendored copy of Vectorscan from source.
To build this crate, you need CMake.
Additionally, if you build with the gen
feature enabled, you will need Clang installed so that bindgen
can produce the raw Rust bindings to Vectorscan.
This has been tested on x86_64 Linux and Intel and ARM macOS.
This crate was adapted from the pyperscan project, which uses Rust to expose Hyperscan to Python.
The bindings implemented here expose just the parts of Vectorscan that are needed by Nosey Parker, specifically, the block-based matching APIs. The various other APIs such as stream- and vector-based matching are not exposed. Other features too, like the Chimera PCRE library, test code, benchmark code, and supporting utilities are disabled.
The source of Vectorscan 5.4.11 is included here in the vectorscan-sys
directory.
The Vectorscan sources were patched for a few reasons:
ragel
.rl
files were precompiled once and added to the source tree-Werror
in all casesThese modifications are not represented as explicit patch files that get applied at build time.
Instead, the modifications were made directly to the vendored source tree.
This was an expedient approach, but something that should be reworked if additional changes to the vectorscan
sources are needed.
Vectorscan is released under a 3-clause BSD license. pyperscan is released under the Apache License Version 2.0 or the MIT license. Boost is released under the Boost License Version 1.0.
cargo install bindgen # if not already installed
mkdir build
cd build
cmake ../vectorscan-sys
cp hs_version.h ../vectorscan-sys/src # from build directory
bindgen vectorscan-sys/src/hs.h -o src/bindings.rs # from root directory
docker build .