https://github.com/boltlabs-inc/vesta
Extensible pattern matching in Rust
https://github.com/boltlabs-inc/vesta
case extensible library macro matching pattern pattern-matching rust rust-crate rust-lang rust-patterns trait
Last synced: 11 months ago
JSON representation
Extensible pattern matching in Rust
- Host: GitHub
- URL: https://github.com/boltlabs-inc/vesta
- Owner: boltlabs-inc
- License: mit
- Created: 2021-04-02T23:32:37.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-04-08T21:38:40.000Z (almost 5 years ago)
- Last Synced: 2024-04-30T17:45:58.778Z (almost 2 years ago)
- Topics: case, extensible, library, macro, matching, pattern, pattern-matching, rust, rust-crate, rust-lang, rust-patterns, trait
- Language: Rust
- Homepage: https://docs.rs/vesta
- Size: 50.8 KB
- Stars: 1
- Watchers: 6
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Vesta
[](https://github.com/boltlabs-inc/vesta/actions/workflows/rust.yml)

[](https://crates.io/crates/vesta)
[](https://docs.rs/vesta)
> A **vesta**, otherwise known as a *match case*, is a small container for matches, named
> after the Roman goddess of the hearth.
>
> **Vesta** is a crate for extensibly *matching cases* in Rust.
By implementing `Match` and `Case` for some type (or better yet, correctly deriving them using the
`Match` derive macro), you can pattern-match on that type using the `case!` macro almost like using
the `match` keyword built into Rust.
However, Vesta's `case!` macro is more general than `match`, because `Match` and `Case` are traits!
This means you can enable pattern-matching for types which are not literally implemented as `enum`s,
and you can write code which is generic over any type that is pattern-matchable.