flow-types 0.1.0-rc.5

The Flow declaration model with no values: types, declarations and their identities, record and enum shapes, and which types decoding may build.
Documentation
//! The declaration model Flow's types are written in, with no values: the
//! types a value crosses the host boundary at ([`Type`]), the declarations
//! they name ([`Decl`], each known by its [`Identity`] in the module its
//! [`ModulePath`] names), the shapes a record
//! or enum value shares with its declaration ([`RecordShape`],
//! [`EnumShape`]), the judgment of which types decoding may build and
//! which values may cross ([`judge`]), and the index decoding finds a
//! declared name by under a [`Spelling`] ([`NameIndex`]).
//!
//! The value model (`flow-lang-value`) builds its records and enums on these
//! shapes, and the value encoding (`flow-abi`) keeps its declarations in a
//! catalog of these and judges them with this kernel, which the checker
//! judges a program's types with too. [`normal_path`] is std's
//! `path.Path` normal form, which a declaration's library is written in, and
//! [`LibraryLayout`] is the one layout of a library's files.

#![cfg_attr(all(coverage, test), feature(coverage_attribute))]

mod builtin;
mod bundle;
mod judge;
mod module;
mod names;
mod nested;
mod path;
mod role;
mod shape;
#[expect(
    clippy::match_same_arms,
    reason = "generated from std, where a literal form's role marks the type of its own role"
)]
#[rustfmt::skip]
mod std_roles;
mod types;

pub use builtin::{Builtin, Head};
pub use bundle::{BundleError, bundled_file};
pub use judge::{Crossing, Reason, Refusal, Settings, Step, judge};
pub use module::{
    KEYWORDS, LibraryLayout, ModulePath, Placement, Segments, SegmentsError, SourcePath,
    SourcePathError, Spelled, Tree, lowercase_name,
};
pub use names::{NameIndex, SharedKey, Spelling};
pub use nested::{Fold, Nested};
pub use path::normal_path;
pub use role::{
    CallField, CodeStepCtor, DecodeErrorField, JsonNamesCtor, JsonProblemCtor, JsonStepCtor,
    JsonValueCtor, Members, Mismatch, OptionCtor, ResultCtor, Role, StdEnum, StdRecord, StopCtor,
    ToolProblemCtor, TypeMismatchField,
};
pub use shape::{Constructor, EnumShape, Payload, RecordShape};
pub use std_roles::{STD_TYPES, Shape};
pub use types::{Body, Decl, DeclId, Identity, MemberDoc, Type, Versions};

/// `n`, a declaration's or parameter's number, as an index: every `usize`
/// this crate is built for holds 32 bits.
fn index(n: u32) -> usize {
    usize::try_from(n).expect("a u32 fits a usize")
}

#[doc(hidden)]
pub use flow_span::spelled as __spelled;