rudb_common/lib.rs
1//! Types, values and errors. The bottom of the workspace.
2//!
3//! Rank 0 in the layer rule, which means everything can see this crate and this crate can see
4//! nothing. See `xtask/layers.toml` and `spec/18-package-layout.md`.
5//!
6//! What lives here is the vocabulary every other crate spells its signatures in. A type, a single
7//! value, an error, a span into the query text that produced it, and the token that says a running
8//! query should stop. Nothing here knows what a vector is, what a plan is or what a file is, and
9//! keeping it that way is what stops rank 0 from becoming a second name for the whole database.
10//!
11//! [`Cancel`] is here for the layer rule rather than because it is a kind of value. The thing that
12//! sets it is the embedding API at rank 13 and the thing that reads it is the executor at rank 12,
13//! so the only place both can see it from is the bottom. The [`slow`] counter is here for the same
14//! reason: the two things that increment it are at rank 1 and rank 3, the thing that reads it is at
15//! rank 4, and no two of those three can see each other.
16
17#![forbid(unsafe_code)]
18
19pub mod cancel;
20pub mod error;
21pub mod memory;
22pub mod slow;
23pub mod types;
24pub mod value;
25
26pub use cancel::Cancel;
27pub use error::{Error, ErrorCode, Result, Span};
28pub use memory::{ALLOCATION, Memory, Reservation, human};
29pub use slow::{Cause, Tally};
30pub use types::{Field, LogicalType, MAX_DECIMAL_WIDTH, PhysicalType};
31pub use value::{Value, civil_from_days, days_from_civil, interval_micros};