Trait constmuck::Infer[][src]

pub trait Infer: Sized + Copy {
    const INFER: Self;
}
Expand description

For constructing Impls* types (values that represent trait bounds), and tuples of them.

For a more concise way to write to Infer::INFER, there’s the infer macro.

Example

use constmuck::cast;
use constmuck::{Infer, ImplsPod, ImplsTransparentWrapper};

use std::num::Wrapping;

const ARR: [i8; 3] = cast([3u8, 5, u8::MAX - 1], Infer::INFER);
assert_eq!(ARR, [3, 5, -2]);

const fn requires_pod<T>(_bounds: ImplsPod<T>) {}
requires_pod::<u32>(Infer::INFER);

const fn requires_2_bounds<T, U>(_bounds: (ImplsPod<T>, ImplsTransparentWrapper<U, T>)) {}
requires_2_bounds::<u32, Wrapping<u32>>(Infer::INFER);
  

Associated Constants

Constructs this type.

Implementations on Foreign Types

Implementors