Skip to content

denizdogan/uwildmat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.