Skip to main content

Module runtime

Module runtime 

Source
Expand description

Entry points for the validation the Evenframe derive generates. Each validator family is bound by a trait, so a validator on a field type it cannot apply to is a compile error rather than a silent pass. A newtype meets each bound its inner type meets.

Structs§

Nanos
A duration already counted in nanoseconds.
Rejection
Why a value failed validation.

Traits§

BigIntValue
An integer a BigIntValidator compares.
ClampTarget
A number, bigint or decimal clamp pulls into range, its bounds written as decimals.
DecimalValue
A decimal a BigDecimalValidator compares exactly, through its text.
DurationValue
A duration a DurationValidator compares, in nanoseconds.
InstantValue
A value a DateValidator compares, as the instant JavaScript’s Date would hold.
ItemCount
A collection an ArrayValidator counts.
Newtype
A struct serde writes as its one field’s value. The derive implements it, so a validator on a field holding the newtype checks the value inside.
NumberValue
A number a NumberValidator applies to, compared as JavaScript does: as an f64.
RoundTarget
A number round rewrites, as JavaScript’s Math.round rounds it.
SortTarget
A list sort orders.
StringTarget
Text a string morph rewrites.
StringValue
Text a StringValidator checks.
UniqueTarget
A list unique drops repeats from.

Functions§

check_big_int
check_date
check_decimal
check_duration
check_items
check_number
check_string
Applies a string check.
clamp_number
Pulls the value into min..=max.
decimal_places
The digits after the point in number’s shortest decimal form, which is how Rust and SurrealDB both write a float, never with an exponent.
is_multiple_of
Effect’s multipleOf: the remainder after scaling both operands to integers by the larger number of decimal places is zero.
morph_string
Applies a string morph in place.
round_number
Rounds the value to places decimal places.
sort_items
Orders the elements ascending.
unique_items
Drops every element equal to an earlier one, keeping the first.