Skip to main content

Nullability

Trait Nullability 

Source
pub trait Nullability:
    Sealed
    + Copy
    + Default
    + 'static {
    type Decoded<T>;
    type Or<Rhs: Nullability>: Nullability;
    type And<Rhs: Nullability>: Nullability;
}
Expand description

Type-level marker saying whether an expression can be NULL.

Implemented only by NonNull and Null. The associated types compute the nullability of combined expressions.

Required Associated Types§

Source

type Decoded<T>

How a decoded value of Rust type T is wrapped: T for NonNull, MaybeNull<T> for Null.

Source

type Or<Rhs: Nullability>: Nullability

NULL propagation: nullable when either side is (a + b, f(a, b)).

SelfRhsOr
NonNullNonNullNonNull
NonNullNullNull
Null_Null
Source

type And<Rhs: Nullability>: Nullability

NULL absorption: nullable only when both sides are (COALESCE(a, b)).

SelfRhsAnd
NonNull_NonNull
NullNonNullNonNull
NullNullNull

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl Nullability for NonNull

Source§

type Decoded<T> = T

Source§

type Or<Rhs: Nullability> = Rhs

Source§

type And<Rhs: Nullability> = NonNull

Source§

impl Nullability for Null

Source§

type Decoded<T> = MaybeNull<T>

Source§

type Or<Rhs: Nullability> = Null

Source§

type And<Rhs: Nullability> = Rhs