Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lots of polishing, regular maintenance, preparing for 0.4 (or 1.0?) release #96

Merged
merged 23 commits into from
Mar 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0cbe12f
cleanup: remove superfluous files
BurntSushi Feb 23, 2020
17b49ef
style: switch to rustfmt
BurntSushi Feb 21, 2020
d7eeeec
ci: switch to GitHub Actions
BurntSushi Feb 21, 2020
743633a
edition: switch to Rust 2018
BurntSushi Feb 21, 2020
3e3d296
polish: clean up all warnings and make things compile
BurntSushi Feb 21, 2020
ad294c8
levenshtein/regex: move levenshtein, remove regex
BurntSushi Feb 21, 2020
1aa9516
bench: switch to criterion for benchmarks
BurntSushi Feb 23, 2020
20f7a90
perf: specialize registry case of two cells
BurntSushi Feb 23, 2020
c7b65fb
style: minor touchups
BurntSushi Feb 23, 2020
ab44e3e
api: make FSTs generic over AsRef<[u8]>
BurntSushi Feb 23, 2020
8d248b7
fst-bin: update dependencies and add some polish
BurntSushi Feb 24, 2020
a1305f4
fst-bin: drop docopt in favor of clap
BurntSushi Feb 24, 2020
0614f04
fst-bin: add knobs for reverse and minimization
BurntSushi Feb 28, 2020
b6c85d7
raw: add get_key/get_key_into APIs
BurntSushi Mar 5, 2020
1953f19
raw: add from_iter_{set,map} convenient constructors
BurntSushi Mar 5, 2020
3235075
tmp: remove fst-bin from workspace
BurntSushi Mar 6, 2020
5ca4776
streams: add "stream with state" APIs
BurntSushi Mar 6, 2020
b6814a4
crc: add CRC32C to every FST
BurntSushi Mar 6, 2020
7f8edc6
deps: remove byteorder
BurntSushi Mar 7, 2020
3972944
polish: get rid of hack used before pub(crate)
BurntSushi Mar 7, 2020
8a368ba
perf: tweak inline annotations
BurntSushi Mar 7, 2020
650480c
polish: more polishing work
BurntSushi Mar 7, 2020
a4c4b32
api: remove AsRef<[u8]> from struct definitions
BurntSushi Mar 8, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 124 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: ci
on:
pull_request:
push:
branches:
- master
schedule:
- cron: '00 01 * * *'
jobs:
test:
name: test
env:
# For some builds, we use cross to test on 32-bit and big-endian
# systems.
CARGO: cargo
# When CARGO is set to CROSS, TARGET is set to `--target matrix.target`.
TARGET:
runs-on: ${{ matrix.os }}
strategy:
matrix:
build:
- pinned
- stable
- stable-32
- stable-mips
- beta
- nightly
- macos
- win-msvc
- win-gnu
include:
- build: pinned
os: ubuntu-18.04
rust: 1.40.0
- build: stable
os: ubuntu-18.04
rust: stable
- build: stable-32
os: ubuntu-18.04
rust: stable
target: i686-unknown-linux-gnu
- build: stable-mips
os: ubuntu-18.04
rust: stable
target: mips64-unknown-linux-gnuabi64
- build: beta
os: ubuntu-18.04
rust: beta
- build: nightly
os: ubuntu-18.04
rust: nightly
- build: macos
os: macos-latest
rust: stable
- build: win-msvc
os: windows-2019
rust: stable
- build: win-gnu
os: windows-2019
rust: stable-x86_64-gnu
steps:
- name: Checkout repository
uses: actions/checkout@v1
with:
fetch-depth: 1

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true

- name: Use Cross
if: matrix.target != ''
run: |
# FIXME: to work around bugs in latest cross release, install master.
# See: https://github.com/rust-embedded/cross/issues/357
cargo install --git https://github.com/rust-embedded/cross
echo "::set-env name=CARGO::cross"
echo "::set-env name=TARGET::--target ${{ matrix.target }}"

- name: Show command used for Cargo
run: |
echo "cargo command is: ${{ env.CARGO }}"
echo "target flag is: ${{ env.TARGET }}"

- name: Build
run: ${{ env.CARGO }} build --verbose ${{ env.TARGET }}

- name: Build docs
run: ${{ env.CARGO }} doc --verbose ${{ env.TARGET }}

- name: Run tests
run: ${{ env.CARGO }} test --verbose --all ${{ env.TARGET }}

- name: Run tests without default features
run: ${{ env.CARGO }} test --verbose --lib --no-default-features ${{ env.TARGET }}

# Disable this for now until we publish regex-automata with fst support.
# - name: Build fst CLI tool
# run: ${{ env.CARGO }} build --verbose --manifest-path fst-bin/Cargo.toml ${{ env.TARGET }}

- name: Compile benchmarks
run: ${{ env.CARGO }} bench --manifest-path bench/Cargo.toml --verbose ${{ env.TARGET }} -- --test

rustfmt:
name: rustfmt
runs-on: ubuntu-18.04
steps:
- name: Checkout repository
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
components: rustfmt
- name: Check formatting
run: |
cargo fmt --all -- --check
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

39 changes: 16 additions & 23 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,31 @@ repository = "https://github.com/BurntSushi/fst"
readme = "README.md"
keywords = ["search", "information", "retrieval", "dictionary", "map"]
license = "Unlicense/MIT"
edition = "2018"

[features]
mmap = ["memmap"]
default = ["mmap"]

[[bench]]
name = "build"
path = "./benches/build.rs"
test = false
bench = true
[workspace]
members = ["bench"]
exclude = ["fst-bin"]

[[bench]]
name = "search"
path = "./benches/search.rs"
test = false
bench = true
[features]
default = []
levenshtein = ["utf8-ranges"]

[dependencies]
byteorder = "1"
memmap = { version = "0.6.0", optional = true }
utf8-ranges = { version = "1.0.4", optional = true }

[dev-dependencies]
fnv = "1.0.5"
fst-levenshtein = { version = "0.2", path = "fst-levenshtein" }
fst-regex = { version = "0.2", path = "fst-regex" }
lazy_static = "0.2.8"
quickcheck = { version = "0.7", default-features = false }
rand = "0.5"
doc-comment = "0.3.1"
fnv = "1.0.6"
memmap = "0.7"
quickcheck = { version = "0.9.2", default-features = false }
rand = "0.7.3"

[profile.release]
debug = true

[profile.bench]
opt-level = 3
debug = true

[package.metadata.docs.rs]
features = ["levenshtein"]
14 changes: 0 additions & 14 deletions Makefile

This file was deleted.

50 changes: 18 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,21 @@ Check out my blog post
Rust](http://blog.burntsushi.net/transducers/)
for extensive background, examples and experiments.

[![Linux build status](https://travis-ci.org/BurntSushi/fst.svg?branch=master)](https://travis-ci.org/BurntSushi/fst)
[![Windows build status](https://ci.appveyor.com/api/projects/status/github/BurntSushi/fst?svg=true)](https://ci.appveyor.com/project/BurntSushi/fst)
[![Build status](https://github.com/BurntSushi/fst/workflows/ci/badge.svg)](https://github.com/BurntSushi/fst/actions)
[![](http://meritbadge.herokuapp.com/fst)](https://crates.io/crates/fst)

Dual-licensed under MIT or the [UNLICENSE](http://unlicense.org).


### Documentation

[Full API documentation and examples.](http://burntsushi.net/rustdoc/fst/)
https://docs.rs/fst

The
[`fst-regex`](https://docs.rs/fst-regex)
and
[`fst-levenshtein`](https://docs.rs/fst-levenshtein)
crates provide regular expression matching and fuzzy searching on FSTs,
respectively.
[`regex-automata`](https://docs.rs/regex-automata)
crate provides implementations of the `fst::Automata` trait when its
`transducer` feature is enabled. This permits using DFAs compiled by
`regex-automata` to search finite state transducers produced by this crate.


### Installation
Expand All @@ -37,33 +35,21 @@ Simply add a corresponding entry to your `Cargo.toml` dependency list:

```toml,ignore
[dependencies]
fst = "0.3"
```

And add this to your crate root:

```rust,ignore
extern crate fst;
fst = "0.4"
```


### Example

This example demonstrates building a set in memory and executing a fuzzy query
against it. You'll need `fst = "0.3"` and `fst-levenshtein = "0.2"` in your
`Cargo.toml`.
against it. You'll need `fst = "0.4"` with the `levenshtein` feature enabled in
your `Cargo.toml`.

```rust
extern crate fst;
extern crate fst_levenshtein;

use std::error::Error;
use std::process;

use fst::{IntoStreamer, Set};
use fst_levenshtein::Levenshtein;
use fst::automaton::Levenshtein;

fn try_main() -> Result<(), Box<Error>> {
fn main() -> Result<(), Box<dyn std::error::Error>> {
// A convenient way to create sets in memory.
let keys = vec!["fa", "fo", "fob", "focus", "foo", "food", "foul"];
let set = Set::from_iter(keys)?;
Expand All @@ -78,13 +64,13 @@ fn try_main() -> Result<(), Box<Error>> {
assert_eq!(keys, vec!["fo", "fob", "foo", "food"]);
Ok(())
}

fn main() {
if let Err(err) = try_main() {
eprintln!("{}", err);
process::exit(1);
}
}
```

Check out the documentation for a lot more examples!


### Cargo features

* `levenshtein` - **Disabled** by default. This adds the `Levenshtein`
automaton to the `automaton` sub-module. This includes an additional
dependency on `utf8-ranges`.
22 changes: 0 additions & 22 deletions appveyor.yml

This file was deleted.

23 changes: 23 additions & 0 deletions bench/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
publish = false
name = "fst-bench"
version = "0.0.1"
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = "Criterion benchmark suite for fst."
homepage = "https://github.com/BurntSushi/fst"
repository = "https://github.com/BurntSushi/fst"
license = "BSD-3-Clause"
edition = "2018"

[lib]
bench = false

[[bench]]
name = "fst"
harness = false
path = "src/bench.rs"

[dependencies]
criterion = "0.3.1"
fnv = "1.0.6"
fst = { version = "*", path = "..", features = ["levenshtein"] }
Loading