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:
| Role | Path | What goes there |
|---|---|---|
main | src/main.rs | wiring only: settings, dev_mcp, Server::run_tls |
lib | src/lib.rs | app() — the routes and middleware, built in a function tests call |
routes | src/routes/ | typed handlers (#[get] …), one module per resource |
models | src/models/ | #[derive(Model)] types |
jobs | src/jobs/ | background jobs and scheduled tasks |
migrations | migrations/ | NNNN_name.sql with an optional NNNN_name.down.sql |
templates | templates/ | Tera templates |
tests | tests/ | integration tests against app() (TestClient) |
static | static/ | 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 layoutuse 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 conventionThe 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
Defaultis the conventional layout (see the module docs). - Layout
Entry - One role of the layout as found on disk (
AppManifest::layout). - Manifest
Error - Why a manifest couldn’t be read: the line (1-based;
0when not about one line) and what to change.
Enums§
- Entry
Kind - 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] andAppManifest::loadaccept (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.