tuple-conv
tuple-conv
provides simple tools for converting tuples with repeated elements
into vectors of that type. Repeated tuples are of the form: (T, T, ... T)
-
composed entirely of elements with type T
.
More information can be found in the documentation.
Example
let t = ;
let v = t.to_vec;
assert_eq!;
Motivation
The primary motivation for this package is syntactic elegance. In Python, we can easily convert tuples to lists with:
=
=
This isn't typically possible in Rust, however, because each tuple is a
distinct type. This isn't too bad, but repeated API calls warrant better
syntax. tuple-conv
provides a way of removing vec![]
macro calls and get a
bit more syntactical sugar without making every part of the public-facing API a
macro.
Documentation
A more in-depth explanation is available at docs.rs