pub struct If<const CONDITION: bool>;
Expand description

Used for constraints conditional on a bool.

Examples

#![feature(generic_const_exprs)]

use fixed::types::extra::{If, True};
fn foo<const U: u32>()
where
    If<{ U > 0 }>: True,
{
    assert!(U > 0);
}

foo::<1>();

This would fail to compile because the constraint is not met:

#![feature(generic_const_exprs)]

use fixed::types::extra::{If, True};
fn foo<const U: u32>()
where
    If<{ U > 0 }>: True,
{
    assert!(U > 0);
}

foo::<0>();

Trait Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Casts the value.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Casts the value.

Casts the value.

Casts the value.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Performs the conversion.

Performs the conversion.

Casts the value.

OverflowingCasts the value.

Casts the value.

Casts the value.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Casts the value.

UnwrappedCasts the value.

Casts the value.

WrappingCasts the value.