Crates.io | tuplez |
lib.rs | tuplez |
version | 0.14.15 |
source | src |
created_at | 2024-02-24 09:12:28.528861 |
updated_at | 2024-06-05 06:25:23.705448 |
description | Tuples represented in recursive form |
homepage | |
repository | https://github.com/NichtsHsu/tuplez |
max_upload_size | |
id | 1151496 |
size | 311,903 |
This crate introduces a tuple type represented in recursive form rather than parallel form.
The primitive tuple types are represented in parallel form, like:
(a, b, c, d ...)
Since Rust doesn't support variadic generics, we cannot add methods to primitive tuples with any number of elements.
Currently, most tuple crates use declarative macros to implement methods for tuples whose number of elements is less than a certain limit (usually 32).
To solve this, tuplez introduces a Tuple
type represented in recursive form, like:
Tuple(a, Tuple(b, Tuple(c, Tuple(d, ...))))
The advantage of this representation is that you can implement methods recursively for all tuples,
and there is no longer a limit on the number of tuple's elements. And, in almost all cases, the Tuple
takes no more memory than
the primitive tuples.
Trait
(e.g. Eq
, Add
), then the Tuple
also implement that Trait
.Please check the documentation for details.