Skip to main content

Module app_manifest

Module app_manifest 

Source
Expand description

rws.app.toml and the conventional app layout (18.28.0). rws.app.toml: the app manifest, and the conventional layout of an rws application (18.28.0, roadmap #87).

One layout an agent (or a person) can rely on without reading the project first:

RolePathWhat goes there
mainsrc/main.rswiring only: settings, dev_mcp, Server::run_tls
libsrc/lib.rsapp() — the routes and middleware, built in a function tests call
routessrc/routes/typed handlers (#[get] …), one module per resource
modelssrc/models/#[derive(Model)] types
jobssrc/jobs/background jobs and scheduled tasks
migrationsmigrations/NNNN_name.sql with an optional NNNN_name.down.sql
templatestemplates/Tera templates
teststests/integration tests against app() (TestClient)
staticstatic/files served as they are

The manifest at the project root names the app and says where a project differs from that layout; every key is optional, so an empty or absent file means “conventional”:

# rws.app.toml
[app]
name = "todos"

[paths]
static = "frontend/dist"   # only what differs from the layout
use rust_web_server::app_manifest::AppManifest;

let manifest: AppManifest = "[paths]\nstatic = \"public\"".parse().unwrap();
assert_eq!(manifest.paths.static_files, "public");
assert_eq!(manifest.paths.routes, "src/routes"); // the convention

The parser reads one line at a time (no recursion), takes at most MAX_MANIFEST_SIZE bytes, and answers bad input with a ManifestError naming the line — it never panics. Keys it doesn’t know are kept as AppManifest::warnings, not errors, so a manifest written for a newer release still loads.

Structs§

AppManifest
rws.app.toml, parsed: the app’s name and where each part of it lives.
AppPaths
Where each part of the app lives, relative to the project root. The Default is the conventional layout (see the module docs).
LayoutEntry
One role of the layout as found on disk (AppManifest::layout).
ManifestError
Why a manifest couldn’t be read: the line (1-based; 0 when not about one line) and what to change.

Enums§

EntryKind
Whether a role’s path is a file (main, lib) or a directory (the rest).

Constants§

FILE_NAME
The manifest’s file name, at the project root.
MAX_MANIFEST_SIZE
The largest manifest [AppManifest::from_str] and AppManifest::load accept (64 KiB); a real one is a few hundred bytes.
ROLES
The roles in AppPaths, as the manifest’s [paths] keys name them, in layout order.