brazier/router

Values

pub fn push(path: String) -> effect.Effect(msg)

Change the URL to path (pushing a history entry) without reloading the page; on_change then runs for the new route, as for a link click. path must be a same-origin path such as /users/7?tab=posts.

pub fn query(uri: uri.Uri) -> List(#(String, String))

The percent-decoded query parameters, in order: ?q=a%20b&page=2 → [#("q", "a b"), #("page", "2")].

Like segments, this crashes on an unchecked URI whose query does not decode.

pub fn redirect(url: String) -> effect.Effect(msg)

Load url as a new page (a full page load, ending this session). url must be a same-origin path, as for push.

pub fn replace(path: String) -> effect.Effect(msg)

Like push, but replaces the current history entry.

pub fn segments(uri: uri.Uri) -> List(String)

The percent-decoded path segments, with empty and dot segments removed: /users/J%C3%BCrgen/ → ["users", "Jürgen"].

Brazier only passes URIs whose encoding it checked to parse; calling this on an unchecked URI with invalid percent-encoding crashes.

✨ Search Document