Skip to content

Commit

Permalink
chore: update release script, improve readme
Browse files Browse the repository at this point in the history
  • Loading branch information
vemonet committed Dec 21, 2023
1 parent ba03b9b commit 3e61eb0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
5 changes: 1 addition & 4 deletions .github/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ sed -i "s/^version = \"[0-9]*\.[0-9]*\.[0-9]*\"\$/version = \"$new_version\"/" "

# Create and push tag
git tag -a v$new_version -m "v$new_version"

git push origin v$new_version

git cliff -o CHANGELOG.md

gmsg "🎉 $new_version released" || true
echo "🎉 $new_version released"
10 changes: 8 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ Running benchmarks requires to enable rust nightly: `rustup default nightly`
cargo bench
```

### 🏔️ Update changelog

```bash
git cliff -o CHANGELOG.md
```

## 🏷️ New release

Publishing artifacts will be done by the `build.yml` workflow, make sure you have set the following tokens as secrets for this repository: `CRATES_IO_TOKEN`, `CODECOV_TOKEN`
Expand All @@ -67,10 +73,10 @@ Publishing artifacts will be done by the `build.yml` workflow, make sure you hav
cargo outdated
```

2. Bump the version in the `Cargo.toml` file, create a new tag with `git`, and update changelog using [`git-cliff`](https://git-cliff.org):
2. Script to automatically bump the version, update the changelog, then create and push a new tag to GitHub:

```bash
./.github/release.sh 0.5.0
```

3. Commit, and push. The `release.yml` workflow will automatically create the release on GitHub, and publish to crates.io.
3. The `release.yml` workflow will automatically create the release on GitHub, and publish to crates.io.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ authors = [
"Alexander Serebryakov <[email protected]>",
"Vincent Emonet <[email protected]>",
]
description = """Generic trie implementation with a support of different key and value types,
and common prefix search."""
keywords = ["trie", "data-structures", "generic"]
description = """Generic trie data structure implementation (prefix tree) with support for different key and value types,
and functions to search for common prefixes or postfixes."""
keywords = ["trie", "data-structures", "generic", "prefix-tree"]
categories = ["data-structures"]
homepage = "https://github.com/vemonet/ptrie"
repository = "https://github.com/vemonet/ptrie.git"
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,21 @@
</a>
</p>

`PTrie` is a versatile implementation of the [trie data structure](https://en.wikipedia.org/wiki/Trie), tailored for efficient prefix searching within a collection of objects, such as strings, with no dependencies.
`PTrie` is a generic implementation of the [trie data structure](https://en.wikipedia.org/wiki/Trie) with no dependencies, tailored for easy and efficient prefix and postfix search within a collection of objects, such as strings.

The structure is defined as `Trie<K, V>`, where `K` represents the type of keys in each node, and `V` is the type of the associated values.
The structure is defined as `Trie<K, V>`, where `K` represents the type of keys in each node (an iterator of the chain to index), and `V` is the type of the associated values (any object to which the key points to).

## 💭 Motivation

The trie is particularly effective for operations involving common prefix identification and retrieval, making it a good choice for applications that require fast and efficient prefix-based search functionalities.

## 🚀 Usage

Results are sorted in ascending order of their length.

### ✨ Find prefixes

You can return all prefixes in the trie corresponding to a given string, sorted in ascending order of their length, or directly the longest prefix.
You can return all prefixes in the trie that matches a given string, or directly retrieve the longest prefix.

```rust
use ptrie::Trie;
Expand All @@ -56,7 +58,7 @@ assert_eq!(longest, Some("ABC"));

### 🔍 Find postfixes

You can also find all strings in the trie that begin with a specified prefix.
You can also find all postfixes in the trie, e.g. all strings which have the given string as a prefix, and extends it.

```rust
use ptrie::Trie;
Expand Down Expand Up @@ -92,6 +94,10 @@ assert_eq!(trie.get_value("none".bytes()), None);

The `serde` feature adds Serde `Serialize` and `Deserialize` traits to the `Trie` and `TrieNode` struct.

```toml
ptrie = { version = "0.5", features = ["serde"] }
```

## 📜 License

[MIT License](https://opensource.org/licenses/MIT)

0 comments on commit 3e61eb0

Please sign in to comment.