Macro typewit::type_ne

source ·
macro_rules! type_ne {
    (< $($generics:tt)* ) => { ... };
    ($left_ty:ty, $($rem:tt)*) => { ... };
    ($($rem:tt)*) => { ... };
}
Expand description

Constructs a TypeNe of types that are statically known to be different.

This macro is syntactic sugar for calling TypeNe::with_fn with a private InjTypeFn implementor.

§Syntax

This macro takes this syntax:

$( < $($generic_param:generic_param),* $(,)? > )?  $left_type:ty, $right_type:ty
$(where $($where_cause:tt)*)?

§Limitations

This macro can’t use generic parameters from the surrounding scope, they must be redeclared within the macro to be used.

§Example

use typewit::TypeNe;
 
const _: TypeNe<u8, (u8,)> = foo();
 
const fn foo<T>() -> TypeNe<T, (T,)> 
where
    (T,): Copy,
{
    typewit::type_ne!{
        <X>  X, (X,) 
        where (X,): Copy
    }
}