Skip to main content

Crate sofie_values

Crate sofie_values 

Source
Expand description

Each value is parsed once at the boundary: deserializing input and decoding a row share it.

Re-exports§

pub use fixture::Fixture;
pub use fixture::InputFixture;
pub use fixture::Samples;
pub use fixture::Seed;

Modules§

fixture
The same seed gives the same values, so a failing test fails again.

Structs§

Coordinate
Whole ten-millionths of a degree, so two equal points compare equal.
Currency
Date
Email
Debug masks it so it stays out of logs.
FormField
Input
Instant
Stored and written in UTC whatever offset it was read with.
LocalDateTime
The instant is worked out when needed, so the time survives a change to the zone’s rules.
Locale
Each part is checked for its shape, not against a registry.
Measurement
Equality compares the unit too: convert before comparing across units.
Money
Part
A part with options is a select.
Percentage
Basis points, so it is exact; may be negative or above 100 %. A JSON number is basis points, text is a percent as a person types it: "19.5" is 1950.
PersonName
One field: names do not split into given and family the same way everywhere.
PhoneNumber
Personal data: Debug masks it.
Secret
No Display and no Serialize, so no reply, log field or event payload can carry it.
Slug
TimeOfDay
To the minute, as a time input posts it; stored as HH:MM text, which sorts as it reads.
TimeZone
Stored by name, so a time kept in it follows the zone’s rules as they change.
Url

Enums§

Constraint
A bound counts characters for text and compares numbers; the derive picks by Measured::TEXT.
Control
EnergyUnit
LengthUnit
LogValue
Operator
Search
How full-text search treats a value: words of Text are matched, an Exact value only whole, Number and Time by range, and a Skipped one never indexed.
Weekday
Stored and sent by its name, as an enum’s variant is; its labels are the weekday enum’s.
WeightUnit
Steps of a nanogram: an ounce is not a whole microgram.

Constants§

EXACT
Codes, flags and sensitive values, whose parts must not be probed.
LATIN_COMBINING_ACCENTS
Decomposed accents, which a slug drops as it spells Latin letters in ASCII.
ORDERED
TEXT

Traits§

Conventions
Filter
FormFields
LogFields
Present
SensitiveFields
Written by #[derive(Aggregate)] for #[sensitive] fields, which log only ***.
SurfacesFromInner
A marker the derive implements; a value overriding a surface implements that trait instead.
Unit
Each unit is a whole number of the quantity’s smallest step: conversion is integer arithmetic.

Functions§

is_slug_character
A letter, digit or nonspacing or spacing mark (L*, N*, Mn, Mc) that lowercasing leaves as it is; anything else parts a slug’s words, unassigned, private-use and format characters too.
percent_text
Basis points as the percent a Percentage control holds, 12.50 for 1250.

Type Aliases§

Energy
Length
Weight