There’s no way to determine how long a tuple is other than already knowing how long it is. You could define and implement a trait for it, but you’d still have to implement it manually for every size of tuple you want to support.

It’s likely you’re trying to use tuples for a something they aren’t meant for. Tuples are basically anonymous structs: containing a well-known number and type of values.

Getting the length of a tuple is not a useful operation in most circumstances, since you also can’t index them with a variable index at runtime, change the length etc.

This may seem odd coming from e.g. Python, where a tuple is basically “an immutable list”, and where people don’t much care about what type they’re using for a one-off sequence. But the distinction between “homogeneous collection” (list/Vec) and “potentially heterogeneous struct” (tuple) is much stronger in Rust.

Just implement Display for particular tuple you want to print out, or if you just want print it for Debug purposes just use {:?} format in println!/format!, which is already implemented for every tuple as long, as Debug is implemented for all its elements.

If you want something that can have different lengths meaningfully, use a fixed-sized array ([&str; 3]) or a reference to a dynamic array &[&str]).

Tuples are data structures with a single size known at compile time- this is what allows them to be heterogeneous (have different times). ("testing", 0, 2) is not a “list of things”, it is specifically one string, two integers.