| Crates.io | wp-model-core |
| lib.rs | wp-model-core |
| version | 0.7.1 |
| created_at | 2026-01-09 11:03:20.979282+00 |
| updated_at | 2026-01-16 08:52:11.307217+00 |
| description | Typed data model crate providing Value, Field, and Record primitives for the Warp PASE stack. |
| homepage | https://github.com/wp-labs/wp-model-core |
| repository | https://github.com/wp-labs/wp-model-core |
| max_upload_size | |
| id | 2031932 |
| size | 133,980 |
wp-model-core is the typed data model that powers the Warp PASE stack. It defines the field, record, and value abstractions that upstream services rely on to validate input, serialize payloads, and reason about metadata in a consistent way. The crate ships as a library only and leans on familiar Rust tooling (serde, chrono, ipnet, smol_str) for ergonomics.
Value::Bool, Value::Email, Value::IpNet, etc.) backed by lightweight smol_str storage for short text fields.DataType, ensuring every value carries run-time constraints (format, semantic type, array hints).Field::from_digit, Record::set_id) plus shared aliases (DataField, DataRecord).LevelFormatAble) for debugging or downstream logging.thiserror based error types that keep callers away from unwrap/expect paths.src/lib.rs exposes model and traits modules.src/model/ hosts the value system, field/record implementations, formatting helpers, macros, and the README.md that documents the design.src/traits.rs provides shared traits such as AsValueRef consumed across models.docs/ holds supplementary specs; AGENTS.md documents contributor expectations.# Cargo.toml
dependencies:
wp-model-core = "0.7"
use wp_model_core::model::{DataField, DataRecord, DataType, Field, Value};
let mut record = DataRecord::default();
record.append(Field::from_digit("count", 42));
record.append(Field::from_chars("status", "ok"));
assert_eq!(record.get_value("count"), Some(&Value::Digit(42)));
Run cargo check for quick iteration, cargo build for release targets, and cargo test to execute the co-located unit suites (see src/model/data/*). Format with cargo fmt --all, lint with cargo clippy --all-targets --all-features -D warnings, and regenerate docs via cargo doc --open when changing public APIs.
Tests live beside their modules (mod tests blocks). Name tests test_* and focus on serialization, comparison, and metadata coverage when introducing a new value type or record behavior. For fuzz targets, lean on the wp-data-model workspace where fuzz harnesses reside.
src/model/README.mdAGENTS.mdwp-labs/wp-model-coreDistributed under the Elastic License 2.0. See LICENSE for details.