UnitTuple

Trait UnitTuple 

Source
pub trait UnitTuple: TupleLen<Len = U0> { }
Expand description

A marker trait for empty tuples (size 0).

This trait is implemented for the unit type () and can be used for type-level programming to identify empty tuples.

§Examples

use tuplities_len::{UnitTuple, TupleLen};
use typenum::U0;

fn is_empty<T: UnitTuple>(_tuple: T) {
    // This function only accepts empty tuples
}

is_empty(()); // This works
// is_empty((1,)); // This would not compile

Part of the tuplities crate.

Implementations on Foreign Types§

Source§

impl UnitTuple for ()

Implementors§