pub trait Constdef {
    const DEFAULT: Self;
}
Expand description

Constant defaults

The Constdef trait is the heart of constant, compile-time default values. This trait is automatically implemented for several types in the standard library.

Implementing this trait

Usually, for implementing this trait – you’ll simply need to use #[derive(bagel::Constdef)] and the macro will do the magic for you. In other cases, you’ll need to implement it yourself, like this for example:

use bagel::Constdef;

struct MyWeirdBool(bool);

impl Constdef for MyWeirdBool {
    const DEFAULT: MyWeirdBool = MyWeirdBool(false);
}

Required Associated Constants

The default value for Self

Implementations on Foreign Types

Implementors