rustio_core/lib.rs
1//! RustIO — a production-grade, strict-by-construction web framework
2//! for Rust.
3//!
4//! Write a model struct, derive `RustioAdmin`, and the framework
5//! provides the admin UI, HTTP/2 server, Postgres ORM, migrations,
6//! full-text search (Meilisearch), sessions, and granular RBAC.
7
8// Phase 7.3 — admin render-test fixtures hand-build large
9// `serde_json::json!` literals (FormField has ~16 fields × multiple
10// fields per fixture). The default recursion limit (128) is too low
11// for those macro expansions; 256 is the conventional bump.
12#![recursion_limit = "256"]
13
14pub mod admin;
15pub mod ai;
16pub mod ai_gen;
17pub mod auth;
18pub mod background;
19pub mod cache;
20// Phase 14 — Schema Contract System (commit 1, types only). Lives
21// under `contract` to avoid colliding with the existing `schema`
22// module (the AI-layer Schema export). The contract module is the
23// single source of truth describing a model's columns, Rust types,
24// expected SQL DDL, and admin/search flags. Commit 1 ships only
25// the types + compatibility helpers; the macro that generates a
26// `ModelSchema` ships in commit 2; the runtime validator that
27// introspects PostgreSQL ships in commit 3.
28pub mod contract;
29// Phase 14, commit 3 — Schema Contract runtime validator. Sibling
30// to the `contract` module (rather than a submodule) so commit 1's
31// `contract.rs` flat layout is preserved without refactoring.
32// Read-only PG introspection only; no admin / search / CLI / migration
33// touchpoints.
34pub mod contract_validator;
35// Phase 14, commit 4 — `rustio doctor --check-schema`'s project-side
36// hook. Pure consumer of the validator; nothing in this module
37// touches the validator types or any other framework subsystem.
38pub mod contract_doctor;
39pub mod error;
40pub mod http;
41pub mod middleware;
42pub mod migrations;
43pub mod orm;
44pub mod router;
45pub mod schema;
46pub mod search;
47pub mod server;
48pub mod templates;
49
50// Common vocabulary at the crate root.
51pub use crate::admin::{Admin, AdminField, AdminModel, FieldType};
52pub use crate::auth::{Identity, Role};
53pub use crate::error::{Error, Result};
54pub use crate::http::{FormData, Request, Response};
55pub use crate::orm::{Db, DbOptions, Model, Row, Value};
56pub use crate::router::{Next, Router};
57pub use crate::search::{Indexer, MeiliClient, Searchable};
58pub use crate::server::Server;
59
60pub use rustio_macros::RustioAdmin;
61
62// `RustioAdmin` emits `::rustio_core::*` paths in its expansion. That
63// resolves cleanly for downstream consumers, but inside this crate's
64// own compilation unit `rustio_core` isn't a known extern. Aliasing
65// the crate to itself under `cfg(test)` lets the macro be exercised by
66// `admin::macro_tests` without changing any non-test build.
67#[cfg(test)]
68extern crate self as rustio_core;