Skip to main content

OptionalNullable

Trait OptionalNullable 

Source
pub trait OptionalNullable: Default {
    type Target;

    // Required methods
    fn is_absent(&self) -> bool;
    fn null() -> Self;
    fn value(value: Self::Target) -> Self;
}
Expand description

Models a fields that may be absent, null, or a value.

Default is required; it constructs the absent state.

Required Associated Types§

Source

type Target

The type for the value when present and non-null.

Required Methods§

Source

fn is_absent(&self) -> bool

Returns true if the instance represents an absent value.

Source

fn null() -> Self

Construct a null.

Source

fn value(value: Self::Target) -> Self

Construct a value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> OptionalNullable for Option<Option<T>>

Source§

type Target = T

Source§

fn is_absent(&self) -> bool

Source§

fn null() -> Self

Source§

fn value(value: Self::Target) -> Self

Implementors§