Tuplespace - Implementing tuples with wildcards


I'm currently learning Rust and chose to implement a tuple space as an exercise to get a grasp on how Rust treats some common concepts, e.g.: data types, multi-threading and network communication.

What stumped me right away was coming up with a suitable data type for the tuple. It is essentially the same as the one Rust provides, while also requiring additional fields like lifetime and wild card support for pattern matching.

After several failed attempts (is it even possible to have structs with tuples as member?) I discovered the rust LinuxTuples implementation which realizes tuples like this:

/// Enum, which is used to contain LinuxTuples element
#[derive(Clone, PartialEq)]
pub enum E {

where a tuple is a vector of E and None is used as a wild card.

This seems a very intuitive approach, and one could build a struct like this

pub struct TupleType {
    content: Vec<E>,
    lifetime: u64,

and call it a day. Or am I missing something?

Is there any other (elegant) approach to implementing a tuple structure like that in Rust?

Yes. It's written like this:

struct SomeStruct {
    tuple_member: (String, String),

For this you need to know in advance which types the tuple will contain. I was thinking more like

struct SomeStruct {
    tuple_member: Tuple(),