Crates.io | uwildmat |
lib.rs | uwildmat |
version | 0.3.0 |
source | src |
created_at | 2023-03-12 16:02:15.947531 |
updated_at | 2023-03-21 09:29:20.996335 |
description | Rust library for wildmat/uwildmat matching |
homepage | |
repository | https://github.com/denizdogan/uwildmat |
max_upload_size | |
id | 808132 |
size | 22,710 |
uwildmat implemented in Rust.
No dependencies.
Heavily based on the original C version of uwildmat, which is part of InterNetNews (INN).
# Cargo.toml
[dependencies]
uwildmat = "0.3"
// your_code.rs
use uwildmat::simple as uwildmat;
let text = "foo";
let pattern = "*foo*";
asserteq!(uwildmat(text, pattern), true);
// or:
use uwildmat::regular as uwildmat;
let text = "foo";
let pattern = "*foo*";
asserteq!(uwildmat(text, pattern), true);
// or:
use uwildmat::poison as uwildmat;
let text = "foo";
let pattern = "*foo*";
asserteq!(uwildmat(text, pattern), true);
This module will not handle invalid UTF-8. INN's uwildmat will (technically) allow any byte sequences as input, even if it is invalid UTF-8.
Use the nightly toolchain:
$ rustup override set nightly
Then the usual:
$ cargo clean
$ cargo build
$ cargo test
$ cargo bench
When making changes, always check how much it affects the performance first.
Before making changes, get a baseline of the "misc" benchmark group:
$ cargo bench --bench misc -- --save-baseline before
After making changes, compare the performance against the baseline:
$ cargo bench --bench misc -- --baseline before
The build script src/build.rs
downloads the INN uwildmat test
suite and processes it, generating an equivalent Rust test suite.