uwildmat

Crates.iouwildmat
lib.rsuwildmat
version0.3.0
sourcesrc
created_at2023-03-12 16:02:15.947531
updated_at2023-03-21 09:29:20.996335
descriptionRust library for wildmat/uwildmat matching
homepage
repositoryhttps://github.com/denizdogan/uwildmat
max_upload_size
id808132
size22,710
Deniz (denizdogan)

documentation

README

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.

Commit count: 39

cargo fmt