Expand description
rustio-admin — Django Admin, but for Rust.
This crate is the public face of the framework. Phase 2 ships the
HTTP / router / server / ORM / migrations / templates core; later
phases populate auth and admin.
Re-exports§
pub use crate::admin::register_admin_routes;pub use crate::admin::Admin;pub use crate::admin::AdminField;pub use crate::admin::AdminModel;pub use crate::admin::BulkAction;pub use crate::admin::BulkActionContext;pub use crate::admin::BulkActionFailure;pub use crate::admin::BulkActionResult;pub use crate::admin::FieldType;pub use crate::admin::FieldValidationError;pub use crate::admin::Fieldset;pub use crate::admin::Inline;pub use crate::admin::ModelAdmin;pub use crate::auth::Identity;pub use crate::auth::Role;pub use crate::error::Error;pub use crate::error::Result;pub use crate::http::FormData;pub use crate::http::Request;pub use crate::http::Response;pub use crate::orm::Db;pub use crate::orm::DbOptions;pub use crate::orm::Model;pub use crate::orm::Row;pub use crate::orm::Value;pub use crate::router::Next;pub use crate::router::Router;pub use crate::server::Server;pub use chrono;pub use rust_decimal;pub use sqlx;pub use uuid;
Modules§
- admin
- The admin panel — Django Admin, Rust-flavoured.
- auth
- Authentication & authorization.
- background
- Background tasks. A tiny runner that spawns one tokio task per recurring job. Kept simple on purpose — we don’t ship a cron DSL, just “run this every N seconds”.
- Email delivery abstraction.
- error
- Unified error type. Every fallible path in the framework returns
Result<T, Error>, and the HTTP layer knows how to turn anErrorinto a proper response. - http
- The HTTP primitives.
RequestandResponseare thin wrappers around hyper’s types that carry a typed context and a few conveniences. - middleware
- Built-in middleware. Each piece is an async function with the
signature
async fn(Request, Next) -> Result<Response>. Drop any of them intoRouter::middleware(...)in whatever order you want. - migrations
- Versioned SQL migrations for PostgreSQL. Transactional; the
rustio_migrationstracking table records which versions have been applied. - orm
- PostgreSQL-backed ORM. A thin shim over sqlx —
Db,Model,Value,Row— and a handful of generic CRUD helpers. Hand-writtenimpl Modelis the contract; users keep writing SQL where it matters. - router
- A small, opinionated router.
- server
- The HTTP server. Binds a TCP listener, runs each connection on its own Tokio task, and shuts down gracefully on Ctrl-C.
- templates
- Template rendering. Rust code passes typed context; this module owns everything about HTML generation.
- view_
layer - Adaptive View Layer.
Structs§
- Date
Time - ISO 8601 combined date and time with time zone.
- Decimal
Decimalrepresents a 128 bit representation of a fixed-precision decimal number. The finite set of values of typeDecimalare of the form m / 10e, where m is an integer such that -296 < m < 296, and e is an integer between 0 and 28 inclusive.- Naive
Date - ISO 8601 calendar date without timezone. Allows for every proleptic Gregorian date from Jan 1, 262145 BCE to Dec 31, 262143 CE. Also supports the conversion from ISO 8601 ordinal and week date.
- Naive
Time - ISO 8601 time without timezone. Allows for the nanosecond precision and optional leap second representation.
- Utc
- The UTC time zone. This is the most efficient time zone when you don’t need the local time. It is also used as an offset (which is also a dummy type).
- Uuid
- A Universally Unique Identifier (UUID).
Functions§
- embedded_
template_ names - Re-exported from
rustio-admin-assetsso the framework’s public API (rustio_admin::embedded_template_names/rustio_admin::embedded_template_source, vialib.rs) is unchanged after the assets split. See that crate for the definitions. Every embedded template name, by canonical path (e.g."admin/list.html"). Order matchesEMBEDDED_TEMPLATESand is stable across builds sorustio-admin overrideenumerates copy candidates deterministically; project code can also iterate this to build documentation pages. - embedded_
template_ source - Re-exported from
rustio-admin-assetsso the framework’s public API (rustio_admin::embedded_template_names/rustio_admin::embedded_template_source, vialib.rs) is unchanged after the assets split. See that crate for the definitions. Return the byte-for-byte source of an embedded template by name, orNonewhen no such template exists. Used byrustio-admin overrideto materialise a copy at<RUSTIO_TEMPLATE_DIR>/<name>so the operator can start editing without first having to find the framework source.