Skip to main content

Crate purwa

Crate purwa 

Source
Expand description

Purwa — opinionated Rust web framework (Sangkan).

Product requirements and architecture: PRD.md at the repository root.

Modules§

routing

Structs§

AppConfig
Framework configuration: purwa.toml + env (PURWA_*).
AppSection
Top-level [app] section in purwa.toml.
AppState
Shared application state (PRD §5.3). Holds Arc resources only — no globals.
DatabaseSection
Top-level [database] section in purwa.toml.
InertiaSection
Top-level [inertia] section — asset versioning for Inertia.js (Sprint 6).
RegisteredRoute
One row for route:list / format_route_table. Handlers register through inventory::submit! (via Purwa proc-macros).
RouteDescriptor
ServerSection
Top-level [server] section in purwa.toml.
ValidatedForm
Form / query extractor: deserialize then run Validate.
ValidatedJson
JSON body extractor: deserialize then run Validate.
ValidationErrorBody
JSON body for validation failures (Laravel-style errors map).

Enums§

PurwaConfigError
Errors while loading or deserializing configuration.
PurwaError
Central framework error type.

Functions§

app_router
Default application router: Sprint 1 hello on / plus any routes registered via Purwa macros (router_from_inventory).
flatten_validation_errors
Flatten ValidationErrors to dot-path keys and message lists (nested structs / lists supported).
format_route_table
Pretty-print METHOD, path, and handler (PRD §11 table style).
init_tracing
Same as init_tracing_with_filter with default "info".
init_tracing_with_filter
Install the global tracing subscriber (pretty in development, JSON when PURWA_ENV=production).
route_descriptors
Iterator over registered route metadata (for tooling and tests).
router_from_inventory
Merge all registered routes into a single Router (unit state).

Type Aliases§

AxumRouter
Type alias for the default Axum router with unit state — use this when composing custom routes.
PgPool
An alias for Pool, specialized for Postgres.

Attribute Macros§

delete
#[delete("/path")] async fn ...
get
#[get("/path")] async fn name(...) -> ...
post
#[post("/path")] async fn ...
put
#[put("/path")] async fn ...
resource
#[resource("/prefix")] pub mod name { pub async fn index() ... pub async fn destroy() ... }