module
effects
Requests for templates: load declarations and the request commands (get, post, put, patch, delete) in handlers.
weft-core only describes a request; whatever installs a requester sends it. weft_data does (in the browser, while prerendering and in tests), with the same loader, parsing and build-time baking as a chart's src. Without one, a load stays loading and a command does nothing.
Structs
- Request
A request a template describes.
Enums
- Purpose
Whether a request is a template's
loador a handler's command.
Functions
resolve
pub fn resolve(url: &str) -> Stringurl resolved against the app's base: data/x.json under /blog/ is /blog/data/x.json. Absolute paths and full URLs stay as they are.
send
pub fn send(req: Request, reply: Reply) -> boolSend req. Returns false (and never calls reply) without a requester. reply may run before this returns, or later.
set_requester
pub fn set_requester(f: impl Fn(Request, Reply) + 'static)Set how template requests are sent.
Type aliases
Reply
pub type Reply = Box<dyn FnOnce(Result<Value, String>)>;Called once with the parsed answer, or a message.