Zippable

Trait Zippable 

Source
pub trait Zippable<T>: TupleLike {
    type ZipOutput: TupleLike;
    type ZipOutput2: TupleLike;

    // Required methods
    fn zip(self, rhs: T) -> Self::ZipOutput;
    fn zip2(self, rhs: T) -> Self::ZipOutput2;
}
Expand description

Zip two tuples.

Required Associated Types§

Source

type ZipOutput: TupleLike

The type of the output generated by zipping two tuples.

Source

type ZipOutput2: TupleLike

The type of the output generated by zipping two tuples, but elements are primitive tuples.

Required Methods§

Source

fn zip(self, rhs: T) -> Self::ZipOutput

Zip two tuples.

Hint: The TupleLike trait provides the zip() method as the wrapper for this zip() method.

§Example
use tuplez::{tuple, TupleLike};

let tup = tuple!(1, 2.0, "3").zip(tuple!("4", 5, 6.0));
assert_eq!(tup, tuple!(tuple!(1, "4"), tuple!(2.0, 5), tuple!("3", 6.0)));
Source

fn zip2(self, rhs: T) -> Self::ZipOutput2

Zip two tuples, but output elements are primitive tuples.

Hint: The TupleLike trait provides the zip2() method as the wrapper for this zip2() method.

§Example
use tuplez::{tuple, TupleLike};

let tup = tuple!(1, 2.0, "3").zip2(tuple!("4", 5, 6.0));
assert_eq!(tup, tuple!((1, "4"), (2.0, 5), ("3", 6.0)));

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Zippable<Unit> for Unit

Source§

impl<First1, Other1, First2, Other2> Zippable<Tuple<First2, Other2>> for Tuple<First1, Other1>
where Other1: Zippable<Other2>, Other2: TupleLike,

Source§

type ZipOutput = Tuple<Tuple<First1, Tuple<First2, Unit>>, <Other1 as Zippable<Other2>>::ZipOutput>

Source§

type ZipOutput2 = Tuple<(First1, First2), <Other1 as Zippable<Other2>>::ZipOutput2>