3 releases (breaking)

0.3.0 Mar 21, 2023
0.2.0 Mar 12, 2023
0.1.0 Mar 12, 2023

#1055 in Text processing

38 downloads per month

MIT license

18KB
428 lines

uwildmat

uwildmat implemented in Rust.

No dependencies.

Heavily based on the original C version of uwildmat, which is part of InterNetNews (INN).

Usage

# 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);

Differences from INN's uwildmat

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.

Development

Use the nightly toolchain:

$ rustup override set nightly

Then the usual:

$ cargo clean
$ cargo build
$ cargo test
$ cargo bench

Benchmarks

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

Build script

The build script src/build.rs downloads the INN uwildmat test suite and processes it, generating an equivalent Rust test suite.

No runtime deps

~0–2.1MB
~31K SLoC