flow-lang-value 0.1.0

The Flow runtime value model: data values, their equality, order and text, and the operations std's built-in types declare.
Documentation
//! The Flow runtime value model.
//!
//! This crate is what a value *is* while a program runs, and the operations
//! the language fixes on values rather than on any one program:
//!
//! - the built-in data types of `data.md` — unbounded [`Int`], exact
//!   [`Decimal`], code-point [`Text`], [`Bytes`], [`List`], [`Dict`] and
//!   [`Set`] sorted by key, [`Duration`] and [`Instant`] — with the operators
//!   std declares for them, including where they fault ([`Fault`]);
//! - records, enum values and tuples by declaration ([`Record`],
//!   [`Variant`], [`Tuple`]);
//! - `types.md`'s structural equality and total order over every data value
//!   ([`compare`], [`equal`]), and the text form interpolation inserts
//!   ([`interpolate`], [`text_form`]);
//! - the values a run holds that are not data — functions and other
//!   evaluator-made values ([`Native`]), task handles ([`TaskId`]) and host
//!   tokens ([`HostToken`]) — which have none of those operations and are
//!   refused by each of them ([`DataError`]).
//!
//! Every rule here is exact and independent of the host's word size, locale,
//! hash order and floating-point unit: replay computes pure work again, so
//! two implementations that disagreed on any result would disagree on a run.
//!
//! # What is deliberately absent
//!
//! **Types.** The checker owns types; at run time a value carries no type
//! beyond the declaration a record or enum value needs for its text.
//!
//! **Encoding.** The JSON value encoding and its canonical form are
//! `abi.md`'s and live with the protocol; this crate exposes the parts an
//! encoder reads.
//!
//! **Limits.** An `Int` has no bound and a `Text` no size here; the host's
//! limits on a program's own values are the evaluator's to enforce, and every
//! measure it needs — [`Int::bits`], [`Text::byte_len`], [`Bytes::len`] —
//! costs constant time.
//!
//! # Unicode
//!
//! Normalization, case mapping, grapheme segmentation and a `Regex`'s classes
//! use the tables of one Unicode version, [`UNICODE_VERSION`], which std's
//! version fixes. Every table comes from a pinned crate; none is the Rust
//! toolchain's.
//!
//! # Depth
//!
//! Equality, order, text and dropping walk a value with a stack on the heap,
//! never the native one, so a value nested as deeply as memory allows is
//! compared, printed and dropped like any other.

mod collection;
mod decimal;
mod error;
mod int;
mod render;
mod shape;
mod text;
mod time;
mod value;

pub use collection::{Dict, List, Set};
pub use decimal::{DIVISION_DIGITS, Decimal};
pub use error::{DataError, Fault};
pub use int::Int;
pub use render::{interpolate, text_form, text_form_within};
pub use shape::{Constructor, EnumShape, Payload, Record, RecordShape, Variant};
pub use text::{Bytes, Text, UNICODE_VERSION};
pub use time::{Duration, Instant};
pub use value::{Holding, HostToken, Native, TaskId, Tuple, Value, compare, equal};

pub use num_bigint::BigInt;

#[cfg(test)]
mod tests;