type-sets 0.2.1

Sets implemented in the rust type-system
Documentation

Crates.io Documentation License

type-sets

Compile-time set operations for Rust tuples.

type-sets provides a collection of traits for working with tuples as type-level sets. You can check membership, compare sets, and construct new sets entirely at compile time.

Read the documentation for more details.

Features

  • Contains<E> — Check whether a set contains a type.
  • Subset<S> — Check whether a set is a subset of another set.
  • Superset<S> — Check whether a set is a superset of another set.
  • SetEqual<R> — Check whether two sets contain the same types.
  • IsEmpty — Check whether a set is empty.
  • Insert<T, E> — Add a type to a set.
  • Union<T, R> — Compute the union of two sets.

Example

use type_sets::*;

assert::contains::<(i32, i16), i32>();
assert::subset::<(i32,), (i32, i64)>();
assert::superset::<(i32, i16), (i32,)>();
assert::eq::<(i32, i16), (i16, i32)>();

Libraries using type-sets

  • axum-error-sets: Flexible responses for Axum handlers with openapi generation.