pub const fn zip4<A, B, C, D>(
wit0: A,
wit1: B,
wit2: C,
wit3: D,
) -> Zip4Out<A, B, C, D>where
A: BaseTypeWitness + Zip4<B, C, D>,
A::L: Sized,
A::R: Sized,
B: BaseTypeWitness,
B::L: Sized,
B::R: Sized,
C: BaseTypeWitness,
C::L: Sized,
C::R: Sized,
D: BaseTypeWitness,Available on crate feature
rust_1_65 only.Expand description
Zips together four BaseTypeWitness types.
§Return type
The return type depends on the types of the arguments:
- if all arguments are
TypeEq, this returns aTypeEq - if any argument is a
TypeNe, this returns aTypeNe - if any argument is a
TypeCmpand no argument is aTypeNe, this returns aTypeCmp
§Example
§Basic
This example shows basic usage.
use typewit::{TypeCmp, TypeEq, TypeNe, type_eq, type_ne};
use typewit::methods::zip4;
with::<u8, u8, bool, u16, u32>(
TypeEq::NEW,
type_ne!(u8, bool),
TypeCmp::Ne(type_ne!(u16, u32)),
);
const fn with<A, B, C, D, E>(eq: TypeEq<A, B>, ne: TypeNe<B, C>, cmp: TypeCmp<D, E>) {
let _: TypeEq<(A, u64, B, i64), (B, u64, A, i64)> =
zip4(eq, type_eq(), eq.flip(), type_eq());
let _: TypeNe<(A, E, B, B), (B, D, A, C)> = zip4(eq, cmp.flip(), eq.flip(), ne);
let _: TypeCmp<(D, A, B, A), (E, B, A, B)> = zip4(cmp, eq, eq.flip(), eq);
}