Skip to main content

NullableFields

Trait NullableFields 

Source
pub trait NullableFields {
    type Root: MergePatchNullableFields;

    // Required method
    fn is_nullable(field: &str) -> bool;
}
Expand description

Which fields of a merge patch struct may be set to null, under its own names.

Implemented for every merge patch model (MergePatchNullableFields), and by #[derive(ValidateNonNullable)] for a struct mirroring one (e.g. an API DTO) or mirroring another mirror (e.g. a gRPC message mirroring the DTO), which asks the struct it mirrors under that struct’s names: so mirrors chain, every chain ending at a merge patch model.

Required Associated Types§

Source

type Root: MergePatchNullableFields

The merge patch model the chain of mirrors ends at (Self for a model). Two structs mirroring each other have none, so they fail to compile rather than ask each other forever.

Required Methods§

Source

fn is_nullable(field: &str) -> bool

Whether the field named field (as on Self) may be set to null.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<T> NullableFields for T

Available on crate feature merge-patch only.
Source§

type Root = T