module
load
A src and its options, the request they make, and reading the answer.
Structs
- Spec
What a component's
srcand related props ask for.
Enums
Functions
next_page
pub fn next_page(spec: &Spec, current: &Request, res: &Response) -> Option<Request>The next page of a response, if it has one and there are rows on this one.
next_page_is_none
pub fn next_page_is_none(current: &Request, res: &Response) -> boolWhether a response is complete, rather than one page of several.
note_browser_load
pub fn note_browser_load()Note that a source on the page being rendered loads (or refreshes, or listens) in the browser, so the page needs the runtime there.
parse
pub fn parse(spec: &Spec, res: &Response) -> Result<Table, Error>Read a response into a table and apply the spec's shaping.
parse_raw
pub fn parse_raw(spec: &Spec, res: &Response) -> Result<Table, Error>Read a response into a table, before any shaping.
record_baked
pub fn record_baked(key: &str, res: &Response)Keep a build-time response so the page can carry it to the browser.
send
pub fn send(req: Request, done: Done)Send a request. done may run before this returns, or later.
set_baked
pub fn set_baked(entries: BTreeMap<String, Response>)What the page carries, in the browser.
set_baked_json
pub fn set_baked_json(j: &Value)Read what the page carries (the JSON of BAKED_ID's element).
set_fetch_remote
pub fn set_fetch_remote(on: bool)Whether the build fetches other sites' data (with the blocking feature). Prerendering turns it on; elsewhere native code never touches the network.
set_loader
pub fn set_loader(f: impl Fn(Request, Done) + 'static)Set how requests are sent (the browser does this when the app starts; tests install a fake).
set_public_dir
pub fn set_public_dir(dir: Option<PathBuf>)Where the site's own files are read from during the build: public/ unless set (a workspace building several apps sets each one's).
take_baked
pub fn take_baked() -> BTreeMap<String, Response>Everything recorded since the last call (one page's worth).
take_browser_loads
pub fn take_browser_loads() -> boolWhether a source noted note_browser_load since the last call (one page's worth).
Constants
BAKED_ID
pub const BAKED_ID: &str = "weft-sources";The id of the script element carrying the build's responses.