zvariant

Trait NoneValue

source
pub trait NoneValue {
    type NoneType;

    // Required method
    fn null_value() -> Self::NoneType;
}
Expand description

Type that uses a special value to be used as none.

See Optional documentation for the rationale for this trait’s existence.

§Caveats

Since use of default values as none is typical, this trait is implemented for all types that implement Default for convenience. Unfortunately, this means you can not implement this trait manually for types that implement Default.

Required Associated Types§

Required Methods§

source

fn null_value() -> Self::NoneType

The none-equivalent value.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T> NoneValue for T
where T: Default,