seam-server
Rust implementation of the SeamJS server core, defining procedures, subscriptions, pages, and an HTML template injector. Built on axum.
Structure
src/lib.rs—SeamTypetrait and primitive JTD schema implementationssrc/server.rs—SeamServerbuilder and axum route handlerssrc/procedure.rs—ProcedureDef/SubscriptionDeftype aliasessrc/page.rs—PageDef/LoaderDeftypessrc/manifest.rs— Build JSON manifest from procedure and subscription definitionssrc/errors.rs—SeamErrorstruct (open code + status)src/injector/— HTML template engine (tokenize, parse, render)
Template Directives
| Directive | Purpose |
|---|---|
<!--seam:path--> |
Text slot (HTML-escaped) |
<!--seam:path:html--> |
Raw HTML slot |
<!--seam:path:attr:name--> |
Inject attribute value |
<!--seam:if:path-->...<!--seam:endif:path--> |
Conditional block |
<!--seam:each:path-->...<!--seam:endeach--> |
Iteration block |
<!--seam:match:path-->...<!--seam:endmatch--> |
Pattern matching block |
Development
- Build:
cargo build -p seam-server - Test:
cargo test -p seam-server
Notes
- The
SeamTypetrait maps Rust types to JTD schemas; derive it with#[derive(SeamType)]fromseam-macros - The injector pipeline mirrors the TypeScript
@canmi/seam-injectorbut is compiled into this crate - SSE subscriptions use
BoxStreamfor async iteration