Crates.io | vectorscan-async |
lib.rs | vectorscan-async |
version | 0.0.2 |
source | src |
created_at | 2023-12-30 14:41:39.81086 |
updated_at | 2024-01-01 17:09:30.600878 |
description | Wrapper for the vectorscan C++ regex library. |
homepage | |
repository | https://github.com/cosmicexplorer/spack-rs |
max_upload_size | |
id | 1084254 |
size | 440,702 |
A Rust wrapper for the vectorscan C++ regex library.
The vectorscan1 library (originally hyperscan2, from Intel) supports high-performance pattern matching using a subset of PCRE syntax. It was originally written for extremely low-latency network traffic monitoring, so it has some interface quirks that may be unfamiliar:
expression::ExpressionSet
]
supports the full range of searching and matching operations available to
individual [expression::Expression
] instances. This is rare: most other
regex engines e.g. do not support finding match offsets, but instead only
which expressions in a set matched.state::Scratch
] to each
search method. This state is not very large, but most other regex engines
attempt to present an interface without any mutable state, even if
internally they use constructions like lazy DFAs.This library uses spack-rs
to configure the build of the
vectorscan codebase using spack
, so it can be precise about which native
dependencies it brings in:
"static"
(default): link against vectorscan statically. Conflicts
with "dynamic"
."dynamic"
: link against vectorscan dynamically. Conflicts with
"static"
, "chimera"
, and "alloc"
. Because of spack
's caching and
RPATH rewriting, the same dynamic library can be shared by every
dependency of this crate."compiler"
(default): whether to bring in the entire libhs
library, or just libhs_runtime
, which is unable to compile patterns
but can deserialize them. This significantly reduces the size of the
code added to the binary."chimera"
: whether to link against PCRE and add in extra vectorscan
code to provide the chimera PCRE compatible search library. Conflicts with
"dynamic"
and requires "compiler"
.Feature flags are also used to gate certain functionality to minimize external dependencies when not in use:
"alloc"
: hook into vectorscan's dynamic memory allocation with
[crate::alloc
]. Requires "static"
due to modifying process-global
hooks."stream"
(default): supports stream parsing with [crate::stream
]."vectored"
(default): supports vectored mode parsing with
[Mode::VECTORED
]."catch-unwind"
(default): catches Rust panics in the match callback
before they bubble back up to vectorscan to produce undefined behavior."async"
: provides an async
interface over vectorscan's quirky
callback API using [tokio
]."tokio-impls"
: implements [tokio::io::AsyncWrite
] for stream
parsers in [crate::stream::channel::AsyncStreamWriter
].BSD-3-Clause, to match the upstream vectorscan project.