pub trait SingletonTuple: TupleLen<Len = U1> { }Expand description
A marker trait for single-element tuples (size 1).
This trait is implemented for single-element tuples (T,) and can be used
for type-level programming to identify single-element tuples.
§Examples
use tuplities_len::{SingletonTuple, TupleLen};
use typenum::U1;
fn is_single<T: SingletonTuple>(_tuple: T) {
// This function only accepts single-element tuples
}
is_single((42,)); // This works
// is_single((1, 2)); // This would not compile
// is_single(()); // This would not compilePart of the tuplities crate.