Rust

Lists, maps, allowed values and optional values.

Contents

use utopia_validators::ArrayList;
Rust
pub struct ArrayList<V>

An array of at most length elements (0 for any number), each valid for inner.

use utopia_validators::Assoc;
Rust
pub struct Assoc

A map: an array that is not a non-empty list, of at most length bytes when encoded as JSON.

Also implements Default.
use utopia_validators::Nullable;
Rust
pub struct Nullable<V>(/// The inner validator. pub V)

Null, or a value the inner validator accepts.

use utopia_validators::WhiteList;
Rust
pub struct WhiteList

A value that is one of a list of allowed values.

Loose (the default): the list and the value are compared as lower-case strings, numeric strings by value, so "Admin" matches admin and 1 matches "1". Strict: the value must be identical to an entry, type included. An array is never allowed.