diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..73f802c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: Cargo Build & Test + +on: + push: + pull_request: + +env: + CARGO_TERM_COLOR: always + +jobs: + build_and_test: + name: Rust project - latest + runs-on: ubuntu-latest + strategy: + matrix: + toolchain: + - stable + - beta + - nightly + steps: + - uses: actions/checkout@v3 + - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} + - run: cargo build --verbose + - run: cargo test --verbose diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f9cd0b..bf98bdd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,59 +1,9 @@ # Changelog All notable changes to this project will be documented in this file. -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - ## [Unreleased] ## [0.1.0](https://github.com/ModelTC/general-sam/releases/tag/v0.1.0) - 2023-10-13 -### Fixed -- fix interface -- fix stub - -### Other -- add release-plz.yml -- add dependabot.yml -- update readme -- add licenses info in readme -- add documentation url to Cargo.toml -- update readme -- update tests and readme usage -- update cargo settings -- add readme to pybind -- add python tests -- add order related interfaces -- add state copy interface -- rename interface -- update readme -- add readme, update examples -- update tests and docstring -- add get_trans for SAM, update python stub -- add token healing -- utf8 or unicode -- update pyo3 -- export other class in the extension -- update __init__.py -- add construct_trie_from_strings -- update stub -- add get_suffix_parent_id -- add trie_utils -- minor fix -- update interfaces -- cooler traveling -- update interfaces -- a little more idiomatic -- add pybind -- remove pyo3 -- add interfaces -- move out tests, add sort utils -- add insert to trie -- minor update for sam -- better naming for IterAsChain -- use Clone rather than Copy -- heal my back -- more type gymnastics, which breaks my back -- type gymnastics -- init -- add licenses +### Added +- Initial repository. diff --git a/README.md b/README.md index c23d276..e84ff04 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A general suffix automaton implementation in Rust. Python bindings and some utilities are also available. -Please check out [`pybind`](./pybind/). +Please check out [`general-sam-py`](https://github.com/ModelTC/general-sam-py). | [![the suffix automaton of abcbc][sam-of-abcbc]][sam-oi-wiki] | | :----------------------------------------------------------------------------: | diff --git a/src/trie_alike.rs b/src/trie_alike.rs index 39556d4..345ac4e 100644 --- a/src/trie_alike.rs +++ b/src/trie_alike.rs @@ -5,6 +5,8 @@ pub enum TravelEvent { Pop(NodeType), } +/// This trait provides the essential interfaces required by `GeneralSAM` +/// to construct a suffix automaton from structures that form a prefix tree. pub trait TrieNodeAlike { type InnerType; type NextStateIter: Iterator; @@ -56,6 +58,9 @@ pub trait TrieNodeAlike { } } +// This struct implements `TrieNodeAlike` for any iterator. +// +// It can be used to construct a suffix automaton directly from a sequence. pub struct IterAsChain { iter: Iter, val: Option,